I could do this myself given time but does anyone have a nice asp.net implementation of an a-z list coming from a sql query. I would like it to come in the form:
A
aardvark
anagram
apple
B
barry
brown....
That is with each entry being a link.
I could do this myself given time but does anyone have a nice asp.net implementation of an a-z list coming from a sql query. I would like it to come in the form:
A
aardvark
anagram
apple
B
barry
brown....
That is with each entry being a link.
Whatever your sql is, just add Upper(Substring([myfield],1,1)) AS Letter
to the select list. Then it's just a matter of showing the letter when it changes.
Unfortunately, that may be easier said than done. ASP.Net doesn't have very good built-in support for control/break style output.
You need to select you column "name" and column "link". Order the list by "name" ascending. In your ASP.Net you need to check when the first letter of the String change... if it change write the first letter so you will get what you want.
Wonder if you could do something like this, but I'm not sure if you can order by a union.
select word from
(select word from table
union all
select Upper(Substring([word],1,1)) as letter from table
) t order by word