Results 1 to 4 of 4

Thread: [RESOLVED] Can a gridview header column be a hyperlink?

  1. #1

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    My Mustang GT
    Posts
    4,566

    Resolved [RESOLVED] Can a gridview header column be a hyperlink?

    Usually when you click the header of a gridview column it means you want to sort on that column. Can I instead have it be a hyperlink to another page? The reason I am asking is because I am converting an ASP page, and that is how it works there. Obiously it's not a gridview though. I was thinking of an alternative that's a button outside the gridview. The gridview shows statuses, such as Pending 3, and there is a status legend that explains what the statuses are. It is this legend I want to display when a user clicks the header. I suppose another alternative would be to put it in each cell, i.e. Pending, Closed, Active could all bring up the legend.

    Your thoughts, please...
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  2. #2
    Member sh4de's Avatar
    Join Date
    Aug 2009
    Location
    Irvine, CA
    Posts
    48

    Re: Can a gridview header column be a hyperlink?

    You can edit the HeaderTemplate for that column

    It will look something like this:

    Code:
       <div>
            <asp:GridView ID="GridView1" runat="server">
                <Columns>
                    <asp:TemplateField HeaderText="test">
                        <HeaderTemplate>
                            <asp:HyperLink NavigateUrl="test.html" runat="server">Test</asp:HyperLink>
                        </HeaderTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </div>
    And have your .NET hyperlink point to a new window or however you want to work it.

  3. #3

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    My Mustang GT
    Posts
    4,566

    Re: Can a gridview header column be a hyperlink?

    Thank you so much!

    And I was going to say, say hello to my friend Tom out there in Irvine, but then I remembered he lives in Trabuco Canyon now!
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  4. #4
    Member sh4de's Avatar
    Join Date
    Aug 2009
    Location
    Irvine, CA
    Posts
    48

    Re: [RESOLVED] Can a gridview header column be a hyperlink?

    Haha, same thing
    Senior Developer @
    Integrated Systems Solutions

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width