Hyperlink with image in datagrid

Discussion in 'ASP .Net' started by Vik, Sep 10, 2003.

  1. Vik

    Vik Guest

    I need to put an image with a hyperlink into a datagrid's column. A file
    name for the image's source and a parameter for the hyperlink should come
    from another datagrid's column. How can I do this?

    Thank you.
     
    Vik, Sep 10, 2003
    #1
    1. Advertising

  2. Vik

    Andrea Zani Guest

    > I need to put an image with a hyperlink into a datagrid's column. A file
    > name for the image's source and a parameter for the hyperlink should come
    > from another datagrid's column. How can I do this?
    >
    > Thank you.


    With TemplateColumn:

    <asp:templateColumn>
    <itemtemplate>
    <asp:HyperLink id="HyperLink1" runat="server" NavigateUrl="yourpage.aspx">
    <img src='<%# DataBinder.Eval(Container.DataItem,"column") %>'
    /></asp:HyperLink>
    </itemtemplate>
    </asp:templateColumn>

    Bye
    --
    AZ
     
    Andrea Zani, Sep 10, 2003
    #2
    1. Advertising

  3. Vik

    Joel Palmer Guest

    I had a similar problem. I ended up having to do it in the stored procedure.
    Someting like this...

    SP:

    select '<a href='+Url+'><img src='+ImgSrc+'></a>' as ImageLink
    ....
    from yourtable


    ASP:

    <Columns>


    <asp:BoundColumn DataField="ImageLink"
    HeaderText="Whatever you want" />

    I am sure there is a better way.

    JOEL

    "Vik" <viktorum@==yahoo.com==> wrote in message
    news:#...
    > I need to put an image with a hyperlink into a datagrid's column. A file
    > name for the image's source and a parameter for the hyperlink should come
    > from another datagrid's column. How can I do this?
    >
    > Thank you.
    >
    >
     
    Joel Palmer, Sep 10, 2003
    #3
  4. Vik

    Noel Hoo Guest

    Hi Vik,

    You'll have to use a templated column and then user the
    DataBinder.Eval(....) to construct the appropriate html tags...

    Hope this helps. (If not drop me an email, and I'll help you through it)

    Regards,
    --
    Noel Hoo
    -centre.com

    "Vik" <viktorum@==yahoo.com==> wrote in message
    news:%...
    > I need to put an image with a hyperlink into a datagrid's column. A file
    > name for the image's source and a parameter for the hyperlink should come
    > from another datagrid's column. How can I do this?
    >
    > Thank you.
    >
    >
     
    Noel Hoo, Sep 11, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. davetichenor
    Replies:
    1
    Views:
    914
    Eliyahu Goldin
    Oct 30, 2006
  2. Ken
    Replies:
    1
    Views:
    432
    Alvin Bruney
    Aug 16, 2003
  3. Vik

    Hyperlink with image in datagrid

    Vik, Sep 10, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    149
    Noel Hoo
    Sep 11, 2003
  4. Trint Smith

    Can you put an image and hyperlink in a web datagrid?

    Trint Smith, Feb 13, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    308
    Alvin Bruney [MVP]
    Feb 15, 2004
  5. Dave
    Replies:
    0
    Views:
    1,002
Loading...

Share This Page