Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > typed DataSet-bound DataGrid sorting

Reply
Thread Tools

typed DataSet-bound DataGrid sorting

 
 
Whugster
Guest
Posts: n/a
 
      06-29-2004
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"



 
Reply With Quote
 
 
 
 
MattC
Guest
Posts: n/a
 
      06-29-2004
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"
>
>
>



 
Reply With Quote
 
 
 
 
Whugster
Guest
Posts: n/a
 
      06-29-2004
Yea that seems to be the problem because binding to a typed dataset happens
underneath. I just dragged and dropped a DataView object to the page and
bind from that object. The solved it. Thanks.


"MattC" <> wrote in message
news:...
> 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"
>>
>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mix statically typed with dynamically typed Yingjie Lan Python 4 01-29-2010 08:50 AM
typed dataset and datagrid DougS ASP .Net 0 01-07-2006 07:09 PM
How can I add a row from a typed datatable to another instance of that typed datatable? Ersin Gençtürk ASP .Net 1 10-06-2004 01:11 PM
Strongly Typed Collection - sort in DataGrid Mark ASP .Net 1 09-22-2004 07:13 PM
Bind strongly typed dictionary class to datagrid? Dot net work ASP .Net Datagrid Control 1 09-08-2004 11:05 AM



Advertisments