【发布时间】:2014-07-07 21:03:44
【问题描述】:
我有一个带有模板字段列的网格视图。 TemplateFields 是这样的:
<asp:TemplateField HeaderText="Title" SortExpression="name" meta:resourcekey="BoundFieldResource1">
<ItemTemplate>
<asp:Label ID="lblTitle" runat="server"
Text='<%# Bind("Name") %>'
meta:resourcekey="BoundFieldResource1"></asp:Label>
</ItemTemplate>
我必须为此列的标题添加自定义属性,因此我删除了 HeaderText 并添加了以下内容:
<Headertemplate>
<asp:Label ID="lblTitleHeading" runat="server" Text="Title" data-custom="tbl-th_title_heading"></asp:Label>
</Headertemplate>
我的问题是,当我这样做时,它会破坏该列的排序,我无法单击标题对其进行排序,我尝试将其更改为但没有做任何事情。 我会很感激你的回答。
【问题讨论】:
标签: sorting webforms custom-attributes aspxgridview templatefield