P prabha k New member Oct 1, 2009 #1 I am displaying the data using pages in Gridview. Whenever we move to the next page, I bind the data. After sorting, while moving to the next page. The data on the next page is not properly displaying. What may be the reasons?
I am displaying the data using pages in Gridview. Whenever we move to the next page, I bind the data. After sorting, while moving to the next page. The data on the next page is not properly displaying. What may be the reasons?
N NetBeans Guest Oct 1, 2009 #2 private void DataGrid1_SortCommand(object source, System.Web.UI.WebControls.DataGridSortCommandEventArgs e) { string sortExpression = (string)Session["SortExp"]; string sortDirection = (string)Session["SortDir"]; if(sortExpression != e.SortExpression) { sortExpression = e.SortExpression; sortDirection = "asc"; } else { if(sortDirection == "asc") sortDirection = "desc"; else sortDirection = "asc"; } Session["SortExp"] = sortExpression; Session["SortDir"] = sortDirection; BindDataGrid(sortExpression + " " + sortDirection); }
private void DataGrid1_SortCommand(object source, System.Web.UI.WebControls.DataGridSortCommandEventArgs e) { string sortExpression = (string)Session["SortExp"]; string sortDirection = (string)Session["SortDir"]; if(sortExpression != e.SortExpression) { sortExpression = e.SortExpression; sortDirection = "asc"; } else { if(sortDirection == "asc") sortDirection = "desc"; else sortDirection = "asc"; } Session["SortExp"] = sortExpression; Session["SortDir"] = sortDirection; BindDataGrid(sortExpression + " " + sortDirection); }