Results 1 to 3 of 3

Thread: Datagrids NavigateURL

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2003
    Posts
    6

    Question Datagrids NavigateURL

    Hey everyone,

    This might sound like a stupid question but I was wondering if there was a way for me to have a HyperlinkColumn in a Datagrid and each Hyperlink went to a different page? At the moment I can only get the hyperlink to point to one site;

    Code:
    <asp:HyperLinkColumn Target="_blank" DataTextField="Headline" SortExpression="Headline" HeaderText="Headline" NavigateUrl="http://www.google.com">
    </asp:HyperLinkColumn>

    If anyone could help me with this it would be greatly appreciated, Thanks.

  2. #2
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092
    How will you get the URL for the hyperlink to use?
    If it is coming from a database or whatever datasource you are using you can use a templete column like this :
    Code:
    <Columns>
        ....
        <asp:TemplateColumn>
            <HeaderTemplate>
    	HeaderText
            </HeaderTemplate>
            <ItemTemplate>
                <asp:HyperLink ID="hyperlink1" Runat=server text="link" NavigateUrl='<%# databinder.eval(container,"dataitem.urltext") %>'></asp:HyperLink>
            </itemTemplate>
        </asp:TemplateColumn>
        ....
    </columns>
    Where urltext is the field in your datasource containing the url.

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2003
    Posts
    6

    Thumbs up [Resolved]

    Cheers mate that worked a treat. Many thanx...

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