我需要订购我的类别标题 -
( <%#Eval("CategoryDescription").ToString().ToUpper()%> )
按字母顺序。我该怎么做呢?谢谢!
下面是 C# 中的代码:
protected void lstvwFileCategory_OnItemDataBound(Object sender,
ListViewItemEventArgs e)
{
if (e.Item.ItemType == ListViewItemType.DataItem)
{
ListViewDataItem temp = (ListViewDataItem)e.Item;
Files.HAHADocument_Category catdata =
(Files.HAHADocument_Category)temp.DataItem;
ListView files = new ListView();
files = (ListView)e.Item.FindControl("lstvwFiles");
files.DataSource = catdata.Documents;
files.DataBind();
}
}
这是代码本身:
<asp:ListView runat="server" ID="lstvwFileCategory"
OnItemDataBound="lstvwFileCategory_OnItemDataBound">
<LayoutTemplate>
<asp:Literal runat="server" ID="itemPlaceholder" />
</LayoutTemplate>
<ItemTemplate>
<div class="linksection">
<h2><%#Eval("CategoryDescription").ToString().ToUpper()%></h2>
<asp:ListView runat="server" ID="lstvwFiles"
OnItemDataBound="lstdvwFiles_OnItemDataBound">
<LayoutTemplate>
<asp:Literal runat="server" ID="itemPlaceholder" />
</LayoutTemplate>
</div>
</ItemTemplate>
</asp:ListView>
和
if (PageID > 0)
{
HAHA_BLL.FileRepository.Files fls = new HAHA_BLL.FileRepository.Files();
lstvwFileCategory.DataSource =
fls.GetHAHADocument_Categories((int)PageID);
lstvwFileCategory.DataBind();
}