spree
03 Jan 2006, 02:52 PM
Hey all, I have my Companies web form which has general information about a company.
Now, I want to be able to sort my current datagrid by its dataset.
I did the following and my data grid goes empty when ever i call the sort event:
In the first case i tried to use the DefaultView
and On the second i used a dataView object, both dont work :/
What am I doing wrong??
the code :
private void DataGrid1_SortCommand(object source, System.Web.UI.WebControls.DataGridSortCommandEventArgs e)
{
/*
DataGrid1.DataSource=dataSet11.Companies.DefaultView;
dataSet11.Companies.DefaultView.Sort=e.SortExpression;
DataGrid1.DataBind();
*/
/*
dataView1.Sort=e.SortExpression;
DataGrid1.DataBind();
*/
}
Now, I want to be able to sort my current datagrid by its dataset.
I did the following and my data grid goes empty when ever i call the sort event:
In the first case i tried to use the DefaultView
and On the second i used a dataView object, both dont work :/
What am I doing wrong??
the code :
private void DataGrid1_SortCommand(object source, System.Web.UI.WebControls.DataGridSortCommandEventArgs e)
{
/*
DataGrid1.DataSource=dataSet11.Companies.DefaultView;
dataSet11.Companies.DefaultView.Sort=e.SortExpression;
DataGrid1.DataBind();
*/
/*
dataView1.Sort=e.SortExpression;
DataGrid1.DataBind();
*/
}