In your binddata method, create a new datatable and dump sqldatareader to datatable:
private void BindData()
{
string strQuery = "select Employee_ID as ID,Employee_Name as Name,Employee_Address as Address,Employee_Email as Email,Employee_Department as Department from ISSSignUp";
try
{
SqlConObject.Open();
SqlCommand sqlcommandobject = new SqlCommand(strQuery, SqlConObject);
SqlDataReader sqldatareaderobject = sqlcommandobject.ExecuteReader();
gridRegistrationTableDetails.DataSource = sqldatareaderobject;
gridRegistrationTableDetails.DataBind();
DataTable dt = new DataTable();
dt = sqldatareaderobject.GetSchemaTable();
Session["Datatable"]=dt;
}
catch (Exception e5)
{
lblError.Text = e5.Message;
}
finally
{
SqlConObject.Close();
}
}
Then in sorting griddata, get the session object back to datatable and pass it to dataview.
DataTable dt=Session["DataTable"] as DataTable;
DataView sortedView = new DataView(dt);
BindData();
sortedView.Sort = e.SortExpression + " " + sortingDirection;
gridRegistrationTableDetails.DataSource = sortedView;
gridRegistrationTableDetails.DataBind();