Click here to Skip to main content
15,886,519 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
I have databound a drop down list to get data from the database. Now i need to sort those values in Ascending order. How can I do this?
PS: I havn't used any coding to retrieve data from DB to dropdown list. Just added a SQL Data Source
Posted

Whenever you are configuring the select statement
you can use ORDER BY button beside the column name selection.

There you have to set SORT BY which column.
 
Share this answer
 
XML
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConnectionString="<%$ ConnectionStrings:DMSConnectionString %>"
        SelectCommand="SELECT * FROM [AppSetting] ORDER BY [SettingID]"></asp:SqlDataSource>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900