Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Gridview Header Template sorting

Reply
Thread Tools

Gridview Header Template sorting

 
 
Felix Wafytech
Guest
Posts: n/a
 
      06-19-2006
Hello All,

I have a Gridview with a Header Template on one of the columns. I would like
to sort by this column. How do I accomplish that? Any help is very much
appreciated.

Note: I'm able to get the sorting to work in all the other columns.

Thanks in advance,
Felix.J


 
Reply With Quote
 
 
 
 
Walter Wang [MSFT]
Guest
Posts: n/a
 
      06-20-2006
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Header files with "header.h" or <header.h> ?? mlt C++ 2 01-31-2009 02:54 PM
Gridview Sorting does not work after dynamically changing the Header text pargat.singh@gmail.com ASP .Net 0 04-24-2007 07:07 PM
Custom GridView Header and sorting Liming ASP .Net 0 10-02-2006 10:41 PM
Gridview sorting - with template columns and stored procedure =?Utf-8?B?RG9ydGU=?= ASP .Net 0 12-14-2005 06:58 AM
sorting on template header ypul ASP .Net 0 12-06-2005 10:15 AM



Advertisments