Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Hyperlink with image in datagrid

Reply
Thread Tools

Hyperlink with image in datagrid

 
 
Vik
Guest
Posts: n/a
 
      09-10-2003
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.


 
Reply With Quote
 
 
 
 
Andrea Zani
Guest
Posts: n/a
 
      09-10-2003
> 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


 
Reply With Quote
 
 
 
 
Joel Palmer
Guest
Posts: n/a
 
      09-10-2003
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.
>
>



 
Reply With Quote
 
Noel Hoo
Guest
Posts: n/a
 
      09-11-2003
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


"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.
>
>



 
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
How to add a hyperlink column to asp.net datagrid - where only one value is a hyperlink davetichenor ASP .Net 1 10-30-2006 02:57 PM
How to add a hyperlink column to asp.net datagrid - where only one value is a hyperlink Dave ASP .Net Datagrid Control 0 10-21-2006 07:48 PM
Can you put an image and hyperlink in a web datagrid? Trint Smith ASP .Net Datagrid Control 1 02-15-2004 04:19 AM
Hyperlink with image in datagrid Vik ASP .Net Datagrid Control 3 09-11-2003 02:39 AM
Dynamically Hyperlink and Event Handler for the Hyperlink ? Ken ASP .Net Datagrid Control 1 08-15-2003 11:38 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57