Reputation: 139
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
Upvotes: 7
Views: 20089
Reputation: 1
In the gridview sorting event bind your gridview again
protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
{
GridView1.DataBind();
}
Upvotes: 0
Reputation: 174
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();
}
Upvotes: 10