HyperLink Column in DataGrid

S

Samuel Shulman

I am trying to add HyperLink column with an image

Below is the code that I use
<asp:TemplateField>

<ControlStyle Height="75px" Width="75px" />

<ItemStyle Height="75px" Width="75px" />

<ItemTemplate>

<asp:HyperLink ID="HPF1" runat="server" Height="75px" Width="75px"
ImageUrl='<%# Eval("ImageFilePath") %>' NavigateUrl='<%# Eval("ProductURL")
%>' />

</ItemTemplate>

</asp:TemplateField>


The problem is that the image appears in it's original size and I want it to
be 75px / 75px only

Thank you,
Samuel
 
P

Patrick.O.Ige

Samuel you aren't giving the image the height and width but the hyperlink.
if you want to use the asp:hyperlink then just resize it
 
S

Samuel Shulman

I can't actually size the picture but I do size the HyperLink

The idea is to have the image within the HyperLink so users can click on the
image and navigate the product's page

Regards,
Samuel
 
P

Patrick.O.Ige

Hi Samuel,
If thats the case then do this
<asp:HyperLinkColumn Target="_blank" DataNavigateUrlField="ID"
DataNavigateUrlFormatString="yourlaspx?ID={0}"
Text="<img border='0'
src='/images/yourimage.gif' />"></asp:HyperLinkColumn>
In the Text="<img border='0' src='/images/yourimage.gif' / height='75px'
width='75px'>"
in Text property resize your image as above
Hope that helps
Patrick
 
S

Samuel Shulman

That works,

Thank you

Samuel

Patrick.O.Ige said:
Hi Samuel,
If thats the case then do this
<asp:HyperLinkColumn Target="_blank" DataNavigateUrlField="ID"
DataNavigateUrlFormatString="yourlaspx?ID={0}"
Text="<img border='0'
src='/images/yourimage.gif' />"></asp:HyperLinkColumn>
In the Text="<img border='0' src='/images/yourimage.gif' / height='75px'
width='75px'>"
in Text property resize your image as above
Hope that helps
Patrick
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top