Thursday, June 11, 2009

How to create an Alphabetical Link ??

The Question:

I need to create a list of Alphabetical links (Ex. A B C D E .....so on) which are bound to a Gridview. On click of "A" the GridView should display all records from database starting with Alphabet "A"........and so on.
FYI.....The Links are outside the GridView. so cant use the Alphabetical paging thing.

Is there any generic way to create the links instead of creating 26 diff links and firing as many events??



Answer1:
u can use select statement to select particular data from the databeese
u said thet u click on "A"
so u have to write the code under the "A" botton click event
assume that ur table name was "student " n the columns are sno,name, marks
here the select quiry to select the student name in alphabetical order
suppose u need to select names which are started vth "A" the the select statement was
select name from student where name like ' %A '


Query:
I am aware of the Select statement......
My main issue is that i dont want to add 26 events......one for each alphabet......is there a way to generate the links.... ??


Answer2:
why dont u use same event say 'openlink' on click of every button?just pass command name for different button for example for a use onclick='openlink' commandname ='a' and in the event use switch case operation.


Searching For Better Solution!


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.