I'm pretty sure you want binding to be the last thing that is done, i.e,
have your dataset sorted then bind it to the grid for displaying.
MattC
"Whugster" <> wrote in message
news:...
> Hi. I have a DataGrid bound to a typed DataSet and I just couldn't figure
> out how to sort the damn thing. I tried setting the Sort property of the
> DataTable.DefaultView and the Attributes["SortExpr"] of the DataGrid but I
> think the order of events matter. Here's a breakdown of events:
>
> 1. Page_Load:
> - call my method LoadGrid( )
> - call Page.DataBind( )
>
> 2. my method LoadGrid:
> - set mytypeddataset = MethodThatGetsFilledDataSet( )
>
> 3. SortCommand grid event handler:
> - mytypeddataset.Tables["MyTable"].DefaultView.Sort = "somesortstring"
>
>
>
|