【发布时间】:2017-12-02 02:30:21
【问题描述】:
我正在尝试在我的网格上应用排序,但在页面加载时需要两次单击才能对数据进行排序。所以当页面加载时。 首先单击任何列)-> 没有排序,但我看到页面正在刷新
第二次点击在任何列上都会对数据进行排序。然后再次重新加载页面后,它将适用于任意次数的点击。
aspx:
<asp:GridView id="SubGrid" runat="server" AutoGenerateColumns="False"
CellPadding="15" AllowPaging="True" PageSize="20" AllowSorting="True"
EmptyDataText="There are now submission to display."
ShowHeaderWhenEmpty="True" DataKeyNames="SubmissionID,Abstract,info,upload,finalized,Submitter"
OnRowCreated="SubGrid_RowCreated" OnRowDataBound="SubGrid_RowDataBound" DataSourceID="SqlDataSource1">
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionStringTest %>" SelectCommand="sb_Getvelue" SelectCommandType="StoredProcedure">
<SelectParameters>
代码背后:
在代码后面我有两个方法
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub SubGrid_RowCreated(sender As Object, e As GridViewRowEventArgs)
----Some Custom Code to add a extra line on top of the grid.
End Sub
Protected Sub SubGrid_RowDataBound(sender As Object, e As
GridViewRowEventArgs)
----- Some code to add tool tip ----
End Sub
【问题讨论】:
标签: asp.net sorting gridview datagrid