dinger2121
Programmer
Hello,
I am trying to implement sorting on a gridview by using the following code -
The problem that I am having is the DataTable tb is returning null, so the sort isn't processing. Does anyone have any thoughts on why it is returning null?
Thanks for any help.
carl
MCSD, MCTS:MOSS
I am trying to implement sorting on a gridview by using the following code -
Code:
protected void grdPerson_OnSorting(object sender, GridViewSortEventArgs e)
{
DataTable tb = myGird.DataSource as DataTable;
if (tb != null)
{
DataView view = new DataView(tb);
view.Sort = e.SortExpression + "" + getSortDirection(e.SortExpression) ;
myGird.DataSource = view;
myGird.DataBind();
}
}
The problem that I am having is the DataTable tb is returning null, so the sort isn't processing. Does anyone have any thoughts on why it is returning null?
Thanks for any help.
carl
MCSD, MCTS:MOSS