You shouldn't have to put it in ViewState. Revert back to the following, but add the first line that I have below and let me know what the output it produces is:
protected void gridView_Sorting(object sender,
GridViewSortEventArgs e)
{
Response.Write(gridView.DataSource.GetType()); //Add this line
DataTable m_DataTable = gridView.DataSource
as DataTable;
if (m_DataTable !=
null)
{
DataView m_DataView = new
DataView(m_DataTable);
m_DataView.Sort = e.SortExpression + " " + ConvertSortDirectionToSql(e.SortDirection);
StrongTypes
All-Star
30801 Points
6013 Posts
ASPInsiders
Re: HOW TO: Using sorting / paging on GridView w/o a DataSourceControl DataSource
Feb 15, 2006 03:02 AM|LINK
You shouldn't have to put it in ViewState. Revert back to the following, but add the first line that I have below and let me know what the output it produces is:
protected void gridView_Sorting(object sender, GridViewSortEventArgs e)
{
Response.Write(gridView.DataSource.GetType()); //Add this line
DataTable m_DataTable = gridView.DataSource as DataTable;
if (m_DataTable != null)
{
DataView m_DataView = new DataView(m_DataTable);
m_DataView.Sort = e.SortExpression + " " + ConvertSortDirectionToSql(e.SortDirection);
gridView.DataSource = m_DataView;
gridView.DataBind();
}
}