Hi Felix,
Thank you for your post.
Based on my understanding, the issue is: You are using a Header Template in
one of the TemplateField column and want to know how to sort by that column
in GridView. If I've misunderstood anything, please feel free to post here.
I think all you need to do is make sure that there's a control in the
Header Template that have correct CommandName and CommandArgument set, for
example:
<asp:TemplateField>
<ItemTemplate>
<%#Eval("ProductName") %>
</ItemTemplate>
<HeaderTemplate>
<asp:LinkButton ID="link1" runat="server" CommandName="Sort"
CommandArgument="ProductName" Text="Hello"></asp:LinkButton>
</HeaderTemplate>
</asp:TemplateField>
The key properties is that we set CommandName="Sort", and
CommandArgument="ProductName" which is the bound field name.
Hope this helps. Please feel free to post here if anything is unclear.
Regards,
Walter Wang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.