databound and hyperlink field needed in gridview

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Carlos

    databound and hyperlink field needed in gridview

    Hi all,

    I need a field that it is both databound, and hyperlink in a gridview. That
    is, the value is obtained from a query, and at the same time needs to point
    to a new page where
    will be used to make another query. How can this be possible in asp .net?

    Thanks in advance,

    Carlos.



  • PeterKellner

    #2
    Re: databound and hyperlink field needed in gridview

    On Wed, 7 Jun 2006 11:00:25 -0400, "Carlos" <ch_sanin@yahoo .com>
    wrote:
    [color=blue]
    >Hi all,
    >
    > I need a field that it is both databound, and hyperlink in a gridview. That
    >is, the value is obtained from a query, and at the same time needs to point
    >to a new page where
    >will be used to make another query. How can this be possible in asp .net?
    >
    >Thanks in advance,
    >
    > Carlos.
    >
    >[/color]

    Hi Carlos,

    I'd suggest adding another column to your gridview of type
    TemplateField. It would look something like what is below. id is a
    column in my database table referenced in gridview's datasource.

    ....
    <asp:BoundFie ld DataField="aka" HeaderText="aka "
    SortExpression= "aka" />
    <asp:TemplateFi eld>
    <ItemTemplate >
    <asp:HyperLin k ID="HyperLink1 "
    NavigateUrl='<% #
    "http://peterkellner.ne t/downloads?id=" + Eval("id") %>'
    runat= "server">GO TO
    PETERKELLNER>NE T</asp:HyperLink>
    </ItemTemplate>
    </asp:TemplateFie ld>
    </Columns>
    </asp:GridView>


    Peter Kellner

    Comment

    Working...