Reputation: 581
This is how I have it in the .aspx
page:
<asp: TemplateField HeaderText="Hide/Show" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:CheckBox ID="HideShowChk" runat="server" Checked='<%# Bind("Hide_Show") %>' />
</ItemTemplate>
<asp: TemplateField>
This is how the TemplateField
is like in Griview
. How do I enable sorting on this since the "Enable Sorting" checkbox in Visual Studio doesn't enable it for this column.
Note, I have absolutely no code in the code behind.
Upvotes: 1
Views: 551
Reputation: 16255
Use the SortExpression
property within the TemplateField
<asp:TemplateField HeaderText="Hide/Show" ItemStyle-HorizontalAlign="Center" SortExpression="Hide_Show">
<ItemTemplate>
<asp:CheckBox ID="HideShowChk" runat="server" Checked='<%# Bind("Hide_Show") %>' />
</ItemTemplate>
<asp:TemplateField>
Upvotes: 1