Random Rows with the DataPager and ListView?

M

MU

Hello

I would like to implement a datapager control on my listview and
return the rows randomly. I am returning the rows with:
ORDER BY NEWID()
which gives me randomized rows but when used with the datapager, when
the user clicks on the Next button, the rows are returned randomized
again, giving me rows that were on the first page.

Is there a way to use the original random dataset instead of it
randomizing again each time the user clicks Next?

Thanks!
MU
 
C

Cowboy \(Gregory A. Beamer\)

Sure. You cache the dataset you originally retrieved and create a custom
pager. If you are generating IDs, you will have to make sure those ids are
added to your data objects (DataSet, LINQ, etc.). There are probably other
ways to skin this cat, as well.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
 

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

Top