1. 程式人生 > >DevExpress AspxGridView分頁使用隱藏系統預設英文分頁

DevExpress AspxGridView分頁使用隱藏系統預設英文分頁

 

1第一篇文章研究了怎麼漢化,但是在實際使用過程中發現漢化的有小問題,DevExpress支援自定義按鈕,也可以在屬性中設定成中文,這樣避免漢化不準確的問題

<dx:ASPxGridView ID="ASPxGridView1" OnCustomButtonCallback="ASPxGridView1_CustomButtonCallback" ClientInstanceName="ASPxGridView1" runat="server" DataSourceID="SqlDataSource1" KeyFieldName="ID" Width="60%" >
<Columns>
<dx:GridViewCommandColumn ShowNewButtonInHeader="true" ShowApplyFilterButton="true" VisibleIndex="0" >
<NewButton Visible="True" Text="新增" />


<EditButton Visible="True" Text="修改" />
<DeleteButton Visible="true" Text="刪除" />
<CancelButton Visible="true" Text="取消" />
<UpdateButton Visible="true" Text="儲存" />
</dx:GridViewCommandColumn>
<dx:GridViewDataColumn FieldName="name" Caption="使用者名稱" VisibleIndex="1"/>
<dx:GridViewDataColumn FieldName="password" Caption="密碼" VisibleIndex="2"/>
<dx:GridViewDataColumn FieldName="chName" Caption="姓名" VisibleIndex="3"/>
<dx:GridViewDataColumn FieldName="phone" Caption="手機號" VisibleIndex="4"/>
<dx:GridViewDataColumn FieldName="sex" Caption="性別" VisibleIndex="5"/>
<dx:GridViewDataColumn FieldName="age" Caption="年齡" VisibleIndex="6"/>
<dx:GridViewDataColumn FieldName="remark" Caption="備註" VisibleIndex="7"/>
</Columns>
<SettingsPager PageSize="6" >
<PageSizeItemSettings Caption="頁數" Visible="True"></PageSizeItemSettings>
<FirstPageButton Text="首頁" Visible="true"></FirstPageButton>
<Summary Visible="false" />
<%--刪除控制元件預設英文下分頁,預設分頁是10--%>
</SettingsPager>
<SettingsBehavior ConfirmDelete="true" />
<SettingsText ConfirmDelete="確定刪除嗎?" />
</dx:ASPxGridView>

<dx:ASPxGridViewExporter ID="ASPxGridViewExporter1" GridViewID="ASPxGridView1" runat="server">
</dx:ASPxGridViewExporter>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DefaultConn %>"
SelectCommand="SELECT * FROM [Winform]" UpdateCommand="UPDATE [Winform] set [name] = @name,[password] = @password,[chName] = @chName,[phone] = @phone,[sex] = @sex,[age] = @age,[remark] = @remark where [ID]= @ID ">
<UpdateParameters>
<asp:Parameter Name="name" Type="String" />
<asp:Parameter Name="password" Type="String" />
<asp:Parameter Name="chName" Type="String" />
<asp:Parameter Name="phone" Type="String" />
<asp:Parameter Name="sex" Type="String" />
<asp:Parameter Name="age" Type="String" />
<asp:Parameter Name="remark" Type="String" />
</UpdateParameters>
</asp:SqlDataSource>

上述程式碼中加粗橙色的程式碼就是將按鈕變成中文,加錯變綠的程式碼就是將預設英文分頁隱藏,這樣就可以設定中文分頁前後效果對比如下圖