469,575 Members | 1,253 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,575 developers. It's quick & easy.

<newbie> HyperLinkField

Hi

asp.net 2.0

I'm trying to implement a HyperLinkField into my GridView.. The
SqlDataSource returns a field which is paths to files (each row in the
GridView should have link to a file).

I've specified DataTextFields and DataNavigationUrlFields with the column
name which holds the path to the document. But the GridView doesn't create a
link, it just displays it as text...

what I do wrong here?
Nov 20 '08 #1
4 2169
On Nov 20, 8:31*am, "Jeff" <it_consulta...@hotmail.com.NOSPAMwrote:
Hi

asp.net 2.0

I'm trying to implement a HyperLinkField into my GridView.. The
SqlDataSource returns a field which is paths to files (each row in the
GridView should have link to a file).

I've specified DataTextFields and DataNavigationUrlFields with the column
name which holds the path to the document. But the GridView doesn't create a
link, it just displays it as text...

what I do wrong here?
Hi Jeff,

what is the code of hyperlinkfield?

Check the following links, maybe you will see the difference
http://authors.aspalliance.com/aspxt...ogridview.aspx
http://msdn.microsoft.com/en-us/libr...linkfield.aspx

Hope this helps
Nov 20 '08 #2
what is the code of hyperlinkfield?
- it is like this: c:\website1\Documents\test.txt

could it be that I'm missing http... in the beginning of the code?
Nov 20 '08 #3
On Nov 20, 10:24*am, "Jeff" <it_consulta...@hotmail.com.NOSPAMwrote:
"sti" have the value "c:\website1\Documents\test.txt"
This path is local. To make the document available for all your
visitors you should change the path to "/Documents/test.txt" if "c:
\website1" is the root directory of your website.
Nov 20 '08 #4
"sti" have the value "c:\website1\Documents\test.txt"
>
This path is local. To make the document available for all your visitors
you should change the path to "/Documents/test.txt" if "c:\website1" is the
root directory of
your website.
Did you consider turning the HyperLinkField into a TemplateField? This gives
better flexability in the control of what happens with your link. I almost
never use HyperLinkFields for that reason. It also lets me do custom code
behind the link clicks and stuff (if you need to do that). By chance you
want to use a TemplateField and put a HyperLink control there instead, then
the HyperLinks should look like this:

<asp:HyperLink id="link" NavigateUrl='<%# Eval("ski") %>' ...
</asp:HyperLink>
Nov 20 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

129 posts views Thread by Torbjørn Pettersen | last post: by
3 posts views Thread by Jeff | last post: by
reply views Thread by Jeff | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.