I'm having trouble sorting a gridview that is using an objectdatasource. The records do not sort when I click on a header. I tried to resolve the issue by storing the datasource results in viewstate. Each time the page posts back, the datatable is empty.
Can somone explain how to get sorting working with an objectdatasource?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
{
public partial class WebForm2 : System.Web.UI.Page
{
private System.Data.DataTable EmpData
{
get
{
DataTable o = ViewState("_EmpData");
if (o == null)
{
return null;
}
else
{
return o;
}
}
...
Go to the complete details ...