[英]error The GridView 'GridView1' fired event Sorting which wasn't handled
I am trying to Create two groups In Data Grid like this example http://www.agrinei.com/gridviewhelper/gridviewhelper_en.htm but there are an error and I don't know what is the reason or how to solve it 我正在尝试在数据网格中创建两个组,如此示例http://www.agrinei.com/gridviewhelper/gridviewhelper_en.htm但有一个错误,我不知道是什么原因或如何解决它
Sorting event seems not handled properly here. 排序事件似乎在这里处理不当。 You can handle it in following manner
您可以通过以下方式处理它
<asp:GridView ID="GridView1" runat="server" AllowSorting="true"
OnSorting="GridView1_Sorting">
</asp:GridView>
protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
{
dataTable.DefaultView.Sort = e.SortExpression ;
GridView1.DataSource = dataTable;
GridView1.DataBind();
}
In the gridview sorting event bind your gridview again 在gridview排序事件中,再次绑定gridview
protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
{
GridView1.DataBind();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.