image instead of text with HyperLinkField control

J

J055

Hi

There doesn't appear to be a ImageUrl property for the HyperLinkField item.
You can set an image in the header but not the field row. Or am I missing
something?

Is there an easy way round this or do I need to create my own solution with
a TemplateItemField or create a custom control?

Thanks
Andrew
 
S

Steven Cheng[MSFT]

Hi Andrew,

As for the hyperlink with image, there is no built-in ASP.NET server
controls associated. Also generally in normal html, we will use html <a>
element with a nested <img> element to display image link. So in asp.net
page, you can consider use the HtmlLink contorl <a runat="server"> with a
nested <img> and we can manipulate it in server-side code.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
J

J055

Thanks again Steven.

I'm still finding my way round the various controls as you can probably
tell!

I realise now that there are many differerent ways to acheive the same
thing. I guess the hardest part is knowing which ones to use in which
situations.

Cheers
Andrew
 
S

Steven Cheng[MSFT]

Thanks for your response Andrew,

Yes, for different page scenario, we may choose to use different html
element combination to construct certain UI layout, and sometimes it also
depend on the developer's personal habit :). Anyway, if you meed any
further problem on this, please feel free to post here.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
R

Reynald Nuñez

The HyperLinkField class itself does not have a member that directly
supports using images. The HyperLink controls that are rendered in the
column, though, include an ImageUrl property that can be set
programmatically during the RowDataBound event of the GridView control
to render image links.

On this page is an example of doing that

http://authors.aspalliance.com/aspxtreme/webforms/controls/addinghyperli
nkfieldstogridview.aspx
____________________

Reynald V. Nuñez
http://authors.aspalliance.com/aspxtreme
 

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
474,263
Messages
2,571,064
Members
48,769
Latest member
Clifft

Latest Threads

Top