Hashtable oLevel = new Hashtable();
oLevel.Add( "1 ", "一级类别 ");
oLevel.Add( "2 ", "二级类别 ");
oLevel.Add( "3 ", "三级类别 ");
oDataList.DataSource = oLevel;
oDataList.DataBind();
<asp:DataList id= "oDataList " runat= "server " RepeatDirection= "Horizontal " >
<ItemTemplate>
<asp:HyperLink id= "hlLevel " runat= "server " Target= "_self " NavigateUrl= ' <%#DataBinder.Eval(Container.DataItem, "Key ", "./Subject_Add.aspx?Level={0} ")%> '> <%#DataBinder.Eval(Container.DataItem, "Value ")%> </asp:HyperLink>
</ItemTemplate>
</asp:DataList>
为什么我这样绑定后,显示的是
"二级类别 " "三级类别 " "一级类别 "
顺序变成了以Value的拼音字母排序了呢,我需要显示的是
"一级类别 " "二级类别 " "三级类别 "
------解决方案--------------------------------------------------------
Hashtable里面的东西是无序的,你用arrayList就可以了
------解决方案--------------------------------------------------------
用arrayList吧
------解决方案--------------------------------------------------------
Hashtable里面的东西确实是无序的
------解决方案--------------------------------------------------------
hashtable 就是ArrayList和SortList混合的么。其实hashtable也可以排序。关键是 哈希表排序了以后,你的结果……
哈哈