Binding Data to DropDown List from Database in Alphabetical order
-
Hi, I have a problem with binding data to dropdownlist from database in alphabetical order. My database contains some fields like All,Air,Airline,Books,Cars etc. There are 2 dropdown lists one dropdown contains A to Z list like A,B,C,D..Z. 2nd list contains above items like All,Air,Books.Now I want that when I select A from A-Z list it will display A items in alphabetical order and the Top item should be "All" after that remaining items.But if I display items in alphabetical order All is displaying like Air,Airline,All.Can anybody help me to resolve the problem. Thanks in advance Pavani
-
Hi, I have a problem with binding data to dropdownlist from database in alphabetical order. My database contains some fields like All,Air,Airline,Books,Cars etc. There are 2 dropdown lists one dropdown contains A to Z list like A,B,C,D..Z. 2nd list contains above items like All,Air,Books.Now I want that when I select A from A-Z list it will display A items in alphabetical order and the Top item should be "All" after that remaining items.But if I display items in alphabetical order All is displaying like Air,Airline,All.Can anybody help me to resolve the problem. Thanks in advance Pavani
So you can't sort alphabetically, you have to provide your data sorted in the order you want.
Christian Graus Driven to the arms of OSX by Vista.
-
Hi, I have a problem with binding data to dropdownlist from database in alphabetical order. My database contains some fields like All,Air,Airline,Books,Cars etc. There are 2 dropdown lists one dropdown contains A to Z list like A,B,C,D..Z. 2nd list contains above items like All,Air,Books.Now I want that when I select A from A-Z list it will display A items in alphabetical order and the Top item should be "All" after that remaining items.But if I display items in alphabetical order All is displaying like Air,Airline,All.Can anybody help me to resolve the problem. Thanks in advance Pavani
U have to use "Order by" clasue. Each and every change event of your drop down list, you have to change your query to bind data.....
Balasubramanian K.
-
U have to use "Order by" clasue. Each and every change event of your drop down list, you have to change your query to bind data.....
Balasubramanian K.
Thanks for your response. I already used order by clause to display in alphabetical order.Then it looks like Air,Airline,All.When we select alphabets A-Z i want to display first All and after that remaining items.Eg if i select A it will display All,Air,Airline if i select B it will display All,Books,Bank etc.All should be at top position.
-
Thanks for your response. I already used order by clause to display in alphabetical order.Then it looks like Air,Airline,All.When we select alphabets A-Z i want to display first All and after that remaining items.Eg if i select A it will display All,Air,Airline if i select B it will display All,Books,Bank etc.All should be at top position.
I think that it is not possible if 'All' is in your database. I think that even you cant use "union all" also. Bind data by excluding 'All' and add it. Before adding add 'All' in to your drop down list directly as first index. I think it is possible. Try it.
Balasubramanian K.
-
I think that it is not possible if 'All' is in your database. I think that even you cant use "union all" also. Bind data by excluding 'All' and add it. Before adding add 'All' in to your drop down list directly as first index. I think it is possible. Try it.
Balasubramanian K.
Thanks for your suggestion.I tried with that I have so many dropdowns like that and I already saved All in database. Now i need to change for all pages.I will follow your suggestion first i will remove binded "All" from dropdown and i will insert at top position.Thank you.
-
Hi, I have a problem with binding data to dropdownlist from database in alphabetical order. My database contains some fields like All,Air,Airline,Books,Cars etc. There are 2 dropdown lists one dropdown contains A to Z list like A,B,C,D..Z. 2nd list contains above items like All,Air,Books.Now I want that when I select A from A-Z list it will display A items in alphabetical order and the Top item should be "All" after that remaining items.But if I display items in alphabetical order All is displaying like Air,Airline,All.Can anybody help me to resolve the problem. Thanks in advance Pavani
HI , in first dropdownlist1 you Bind All Allphabates . in selection of First Dropdownlist you have to Bind Second Dropdownlist with query ; it may be like this . select * from tablename where fieldname like 'dropdownlist1.selectedtext.text%' Try This may be its help .