HyperLink Column in DataGrid

  • Thread starter Thread starter Samuel Shulman
  • Start date Start date
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
 
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
 
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
 
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
 
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
 
Back
Top