Datagrid hyperlinks

G

Graeme

Hello

I thought if I linked a datagrid column to a field containing something like
this ... <a href="http://www.google.com"
target="_blank">http://www.google.com</a> ... that it might appear
hyperlinkable in the grid. But alas, no.

What I currently have is a non-template bound column connecting a data field
which may contain, amongst other text, a URL (or maybe an Email address). Is
there any way to have just the URL part hyperlinkable so user can click and
redirect?

Or do I HAVE to use a Hyperlink column for this? Problem I see here is that
I only want the URL part hyperlinkable; not the complete text (which could
be several sentences).

Any ideas most welcome.

Thanks
Graeme
 
K

Konrad Rotuski

Graeme said:
Hello

I thought if I linked a datagrid column to a field containing something like
this ... <a href="http://www.google.com"
target="_blank">http://www.google.com</a> ... that it might appear
hyperlinkable in the grid. But alas, no.

probably this is escaped to &lt;a href= ... hope you get the idea, thats why
its not hyperlink in the grid
What I currently have is a non-template bound column connecting a data field
which may contain, amongst other text, a URL (or maybe an Email address). Is
there any way to have just the URL part hyperlinkable so user can click and
redirect?

Or do I HAVE to use a Hyperlink column for this? Problem I see here is that
I only want the URL part hyperlinkable; not the complete text (which could
be several sentences).

simplest way to accomplish this would be to use TemplateColumn

HTH

Konrad
 
G

Graeme

Thanks for quick response, Konrad! Well, I did try template but still stuck
.... how to make it grab the tags and make it hyperlinkable? Can you help
more? Thanks
 
K

Konrad Rotuski

<asp:TemplateColumn>
<ItemTemplate>
some text, not hyperlinkable <a
href='http://www.google.com'>hyperlink text</a> some more nothyperlinkable
text <%#DataBinder.Eval(Container.DataItem, "SomeColumn")%>
<ItemTemplate>
</asp:TemplateColumn>

what do you mean by 'grab the tags' .. i dont get it .. ?

Konrad
 
E

Eeediot

You can also use the SPAN tag:

<span onclick="...">some text</span>

But this only works with web browsers that support HTML 4.
 
G

Graeme

Sorry ... worked all the time! I wasn't storing it in correct format in db.
Graeme (AKA Oaf)
 

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,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top