'counting' alphabetically?

D

darrel

I have a userControl that displays a repeaterControl to display data. I have
this set up so that it pages, 10 records per page.

This works fine.

Now, for some of the data, it'd be nice if the end-user could jump to the
page alphabetically.

For instance, their may be 80 pages with 10 biographies each. Instead of the
end user clicking NEXT, NEXT, NEXT until he finds the bio he's looking for
(let's say Smith, Bob) I'd like for them to be able to click on "s" and jump
to the particular page where the S's begin.

Any thoughts on how to do this? Off the top of my head, this is what I'm
thinking:

- Grab all records (last name)
- trim field to first letter
- Parse all of these to grab only unique letters
- Attach that to an array
- Step through the array to write out each letter navigation
- upon click of 's', query database to grab all records (last name) sorted
by last name
- count through the records to get to the first record beginning with 's'/
- divide by 10
- redirect to the 10th 'page' of the record set.

But that seems tedious. Is there a better/more streamlined way?

-Darrel
 
C

Chandra Sekhar

Datagrid paging is too rude. If you want something other than numbers or
previous/next, its always a long route. Hopefully MS will address this issue
soon.

Sekhar.
 
D

darrel

If you want something other than numbers or
previous/next, its always a long route.

Ah...well, I guess I better get comfortable for the long haul. ;o)

-Darrel
 
S

Scott Allen

Hi Darrel:

I was thinking perhaps a different approach would be easier to
implement (if it meets your requirements).

Have hyperlinks for each letter of the alphabet available, and instead
of having them jump to the page, have them filter the records.

You could do this with the RowFilter property of a DataView object
(assuming you have a DataSet), or by passing a parameter to use in the
WHERE clause of your SQL query (but be careful - because this approach
can reak havoc with the query optimization).

HTH,
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top