在下拉列表中对项目进行排序ASP.Net [英] sort items in dropdown list ASP.Net

查看:63
本文介绍了在下拉列表中对项目进行排序ASP.Net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个绑定数据的下拉列表,用于从数据库中获取数据.现在,我需要按升序对这些值进行排序.我该怎么办?
PS:我没有使用任何编码来从DB到下拉列表中检索数据.刚刚添加了一个SQL数据源

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

推荐答案

无论何时配置select语句
您可以使用列名选择旁边的ORDER BY按钮.

在那里,您必须设置SORT BY哪一列.
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.


<asp:SqlDataSource ID="SqlDataSource1" runat="server"

        ConnectionString="<%


ConnectionStrings:DMSConnectionString %> ; " span> SelectCommand =" 选择*从[AppSetting]顺序按[SettingID]" ">< ; /asp:SqlDataSource >
ConnectionStrings:DMSConnectionString %>" SelectCommand="SELECT * FROM [AppSetting] ORDER BY [SettingID]"></asp:SqlDataSource>


这篇关于在下拉列表中对项目进行排序ASP.Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆