I have a MyDataSet : DataSet class which contains 3 talbes and 2 data relations. This is set to a custom datagrid which can expand to show something like Users -> tickets for user -> details of ticket. I'm sure this is entirely simple, but how do I sort while keeping my dataset as the datasource? When I google they always discard the dataset and do something like:
Code:
MyDataSet ds = (MyDataSet) _dgUsers.DataSource;
DataView dv = ds.Tables[0].DefaultView;
dv.Sort = "something ASC";
_dgUsers.DataSource = dv;
_dgUsers.DataBind();
This is useless as I've just lost my dataset. I tried modifying the view of the table inside the dataset but it just gets ignored (although it remains set when I sort again):
Code:
MyDataSet ds = (MyDataSet) _dgUsers.DataSource;
DataView dv = ds.Tables[0].DefaultView;
dv.Sort = "something ASC";
_dgUsers.DataSource = ds;
_dgUsers.DataBind();
How should it be done? When I clone the DataSet it seems to work. Why is that?