我有下面的代码填充一个DropDownList:如何排序一个DropDownList
DataSet ds = new DataSet();
SPSite mySite = SPContext.Current.Site;
SPWeb myWeb = mySite.OpenWeb();
SPList list = myWeb.Lists["GuidelineTopics"];
DTable_List = list.Items.GetDataTable();
DTable_List.TableName = "Table1";
DTable_List.DefaultView.Sort = "Title ASC";
ds.Tables.Add(DTable_List);
Topic.DataSource = ds.Tables["Table1"];
Topic.DataSource = DTable_List;
Topic.DataTextField = "Title";
Topic.DataValueField = "Title";
Topic.DataBind();
Topic.Items.Insert(0, new ListItem("All Topics", "All Topics"));
Topic.SelectedIndex = 0;
我如何应用排序的列表,以便它要么ASC或DESC按字母顺序?
你指的是哪个列表?看看Linq http://msdn.microsoft.com/en-us/library/vstudio/bb534966(v=vs.100).aspx – Vadim 2014-09-24 20:50:10
'主题'是我的DropDownList – SearchForKnowledge 2014-09-24 20:50:35