Sorting datagrid?

J

Joris De Groote

Hi,

I have created a webpage with a datagrid. The page fills in the datagrid
after the user selected some things (it's a searchpage). Now the page show
everything from an SQL server sorted on productnumber.
How can I let the users change the sorting of the documents without always
having to get the data again from the SQL server?

Thanks
Joris
 
G

Guest

Well you can't really unless you store the data in something like a session
variable or a cookie but this would be much less efecient than getting the
data again from the SQL server. Let SQL server do the sort, it's what it is
designed to do and it will do it much better than anything client side could.
 
S

Swanand Mokashi

You can always Cache your data and then sort it client-side. However as
clickon said SQL server is more efficient in sorting

--
Swanand Mokashi
Microsoft Certified Solution Developer (.NET) - Early Achiever
Microsoft Certified Application Developer (.NET)

http://www.dotnetgenerics.com/
DotNetGenerics.com -- anything and everything about Microsoft .NET
technology ...

http://www.swanandmokashi.com/
http://www.swanandmokashi.com/HomePage/WebServices/
Home of the Stock Quotes, Quote of the day and Horoscope web services
 
J

Joris De Groote

OK, thanks clickon & swanand mokashi

I'll use the SQL server for the sorting.
 
M

Mukesh

hi
joris u can use this method

create a dataset(ds)
put some data

create a sort string
(i.e. sortString = "ProductNameColumn desc")

now do this
ds.Tables[0].DefaultView.Sort = sortString;
PagedDataSource objPage = new PagedDataSource();
objPage.DataSource = ds.Tables[0].DefaultView;
MailsList.DataSource = objPage;

Now give me thanks
n bye gud nite (according to india)

Mukesh Agarwal
New Delhi
 

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,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top