PC Review


Reply
Thread Tools Rate Thread

default sort on gridview load

 
 
=?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?=
Guest
Posts: n/a
 
      29th Jan 2007
For performance reasons i can not set a sort order on a dataset returned from
a stored procedure. Ideally in the sp i'd set the company name as the order
and just load the gridview, however the joins are very complicated and this
causes the sp to take 20 time (at least) longer than when no ordering is
specified. I would create a temp table and sort this for the return, however,
ado.net can not see a temp table because it does not exist at the conclustion
of the sp. I REALLY do not want to use an inline adhoc query that joins 15
table and uses derived result sets to get all the information. The sp
performs very well so long as no attempt to order the result is made.

So here is my issue:
I need to set the default order to company name on the result set on initial
datagrid load. Is there a way to do this? And where? and How?

I think this one is an issue some others have faced and i'd really like you
help.

Thanks!
--
thanks (as always)
some day i''m gona pay this forum back for all the help i''m getting
kes
 
Reply With Quote
 
 
 
 
GroupReader
Guest
Posts: n/a
 
      29th Jan 2007
1. Create a "DataView" from your "DataSource"
2. Set the sort order and/or filters in the DataView. (see the .Sort
and .RowFilter properties)
3. Bind the dataview (not the datasource) to your GridView

 
Reply With Quote
 
=?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?=
Guest
Posts: n/a
 
      29th Jan 2007
will sorting then be handled as usual or are there extra steps needed when a
column is selected for alternate sorting such as the older datagrid?
--
thanks (as always)
some day i''m gona pay this forum back for all the help i''m getting
kes


"GroupReader" wrote:

> 1. Create a "DataView" from your "DataSource"
> 2. Set the sort order and/or filters in the DataView. (see the .Sort
> and .RowFilter properties)
> 3. Bind the dataview (not the datasource) to your GridView
>
>

 
Reply With Quote
 
GroupReader
Guest
Posts: n/a
 
      30th Jan 2007
When the user clicks on a column (to sort that column), you'll have to
handle the appropriate "sorting" event.

In the "sorting" event-handler, you need to:
- requery the data
- create a dataView from the dataset or datatable
- set the sorting on the dataview
- bind the dataview to the grid

Additionally, there are steps you need to take to set the correct up/
down arrow in the grid column header if you want a graphic to show
which column is sorted. Some people use images. Some people use
these unicode chars:&#9650" and "&#9660" to show up/down arrows. For
compatibility reasons, the images are best. I don't have the code in
front of me, but I remember being very "surprised" at how not-so-easy
this was.




 
Reply With Quote
 
=?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?=
Guest
Posts: n/a
 
      30th Jan 2007
ok same as a datagrid.
thnaks
kes
--
thanks (as always)
some day i''m gona pay this forum back for all the help i''m getting
kes


"GroupReader" wrote:

> When the user clicks on a column (to sort that column), you'll have to
> handle the appropriate "sorting" event.
>
> In the "sorting" event-handler, you need to:
> - requery the data
> - create a dataView from the dataset or datatable
> - set the sorting on the dataview
> - bind the dataview to the grid
>
> Additionally, there are steps you need to take to set the correct up/
> down arrow in the grid column header if you want a graphic to show
> which column is sorted. Some people use images. Some people use
> these unicode chars:▲" and "▼" to show up/down arrows. For
> compatibility reasons, the images are best. I don't have the code in
> front of me, but I remember being very "surprised" at how not-so-easy
> this was.
>
>
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Return GridView sort to default David C Microsoft ASP .NET 2 15th Jun 2009 08:49 PM
GridView's selection isn't causing other GridView's to load data asexpected Rasika WIJAYARATNE Microsoft ASP .NET 0 14th Dec 2007 12:25 AM
Gridview encoding, or how to run commands before gridview's default databinding, or, how do I disable default databinding at all? Sergei Shelukhin Microsoft ASP .NET 1 12th Nov 2006 01:43 PM
sort gridview =?Utf-8?B?Q1NoYXJwZ3V5?= Microsoft ASP .NET 4 17th Aug 2006 09:01 PM
Default sort column and order in Gridview? Daves Microsoft ASP .NET 2 26th Feb 2006 06:52 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:41 AM.