Home All Groups Group Topic Archive Search About

ASP.NET 2.0 sort DataList without query again

Author
7 Jan 2006 12:57 AM
hohans
Hi All,

In 2.0, how do you sort DataList without executing the query again?

So far what I found in the Web all show examples where you need to
re-execute the query against DB with passed in field name and sort
direction.  The data source has been bound to the control.  Can we
somehow just retrieve it, sort it and bind it again?  Any ideas will be
truely appreciated.

Hans

Author
8 Jan 2006 4:18 AM
funphxnaz
Yes, I just posted something similiar and would like to know.
Author
8 Jan 2006 7:06 PM
funphxnaz
Anyone??
Author
9 Jan 2006 1:23 AM
Axel Dahmen
Hi Hans,

actually what happens when you bind a data control do a data source is that
it reads the data contained in the data source and creates html from it when
you call the DataBind() function. It doesn't store the data source any
further than that.

The syntax is a bit confusing, I must admit. It would have been simpler to
understand if there wasn't a DataSource property and if the DataBind()
function had the data source as its sole parameter, like
"DataBind(myDTable);".

HTH,
www.sportbootcharter.com
Axel Dahmen


---------------
<hoh***@yahoo.com> schrieb im Newsbeitrag
Show quoteHide quote
news:1136595452.151862.43300@o13g2000cwo.googlegroups.com...
> Hi All,
>
> In 2.0, how do you sort DataList without executing the query again?
>
> So far what I found in the Web all show examples where you need to
> re-execute the query against DB with passed in field name and sort
> direction.  The data source has been bound to the control.  Can we
> somehow just retrieve it, sort it and bind it again?  Any ideas will be
> truely appreciated.
>
> Hans
>
Author
9 Jan 2006 7:21 PM
hohans
Hi Axel

or anyone who would like to give input:

If the data source bound to a control is just for reading, then how
does it maintain view state?  Remeber when EnabledViewState is true, it
is supposed to (actually it does do) display the same data accross page
postback, right?

Hans