473,387 Members | 3,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

HyperLink Column in DataGrid

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

Dec 6 '06 #1
4 2196
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

"Samuel Shulman" <sa************@ntlworld.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
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

Dec 7 '06 #2
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

"Patrick.O.Ige" <na********@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
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

"Samuel Shulman" <sa************@ntlworld.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>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


Dec 7 '06 #3
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

"Samuel Shulman" <sa************@ntlworld.comwrote in message
news:e2**************@TK2MSFTNGP05.phx.gbl...
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

"Patrick.O.Ige" <na********@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
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

"Samuel Shulman" <sa************@ntlworld.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
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


Dec 7 '06 #4
That works,

Thank you

Samuel

"Patrick.O.Ige" <na********@hotmail.comwrote in message
news:uY**************@TK2MSFTNGP03.phx.gbl...
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

"Samuel Shulman" <sa************@ntlworld.comwrote in message
news:e2**************@TK2MSFTNGP05.phx.gbl...
>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

"Patrick.O.Ige" <na********@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
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

"Samuel Shulman" <sa************@ntlworld.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
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





Dec 7 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ravikanth[MVP] | last post by:
Hi asp:DataGrid id="YourID" runat="server" AutoGenerateColumns="False"> <Columns> <asp:TemplateColumn HeaderText="Sample Column"> <ItemTemplate> <asp:Hyperlink runat="server" Text='<%...
2
by: damonf | last post by:
I'm currently trying to add an ASP hyperlink to a template column in a datagrid. The normal hyperlink column doesn't give me the ability to add attributes to the item. In my grid there are four...
2
by: Alex | last post by:
I would like to have one column in my DataGrid that content acts as a hyperlink. In addition to that I would like that the content is databound to a DataSet source. If I create a hyperlink...
9
by: Paul | last post by:
Hi I have a data grid with a hyperlink column. the colum has numbers like 00001,000002, ect. Just wondering how to get the text value of the cell as tempstring =...
1
by: D. Shane Fowlkes | last post by:
Hello All. I keep asking for help with this on the www.asp.net forums and nobody seems to be able to help. What I'm trying to accomplish is very simple. I simply want to create a Hyperlink...
6
by: epigram | last post by:
I'm using the DataGrid with AutoGenerateColumns set to false and choosing which columns I want in the grid by using the <Columns> attribute. What I want to do is to create a hyperlink out of one...
3
by: Tim::.. | last post by:
I currently have the following datagrid but want to turn the name and email column into a hyperlink in the codebehind! Can someone please tell me how I achieve this! Thanks Private Sub...
10
by: david | last post by:
Hi, all: I need a help from you about DataGrid control. I created a DataGrid, dg, in design view of .NET visual Stadio and use the builder to add a Hyperlink column to dg. I want to try to assign...
19
by: Joe | last post by:
I have an aspx page (referred to here as page_1) with a datagrid whose first column contains hyperlinks. When a user clicks one of these hyperlinks, he will navigate to another aspx page (referred...
3
by: TPhelps | last post by:
I have a sample of an unbound (autogeneratecolumns is true) sortable/pagable datagrid that works. I want to change one of the columns to a hyperlink. The examples I find use a bound column. I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.