Sorting DataGrids in ASP.NET

C

C

I have a datagrid that I sort by passing in a Sort Expression to a Sub which builds a dynamic order by clause and passes this into a Stored Proc.

Do I need to make a call to my Stored Proc each time the user sorts a column?

It just means that there is a trip to the DB each time they sort.

Any advice on this is much appreciated.

Thanks,
C.
 
S

Sandeep Kayal

You can eliminate this by storing the DataSource of te DataGrid in a
ViewState object. In this way you won't need to make a trip to the database
every time.

Thanks,
Sandeep

C said:
I have a datagrid that I sort by passing in a Sort Expression to a Sub
which builds a dynamic order by clause and passes this into a Stored Proc.
 
A

ashelley

I have a datagrid that I sort by passing in a Sort Expression to a Sub which builds a dynamic order by clause and passes this into a Stored Proc.

Do I need to make a call to my Stored Proc each time the user sorts a column?

It just means that there is a trip to the DB each time they sort.

Any advice on this is much appreciated.

Thanks,
C.

The dataview object has a sort function. if you put u're data into a
dataview and then bind the dataview to the datagrid you will persist
the dataview in a session and just resort it.

-adam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top