Solved

Gridview HyperLinkField

Posted on 2006-10-26
4
680 Views
Last Modified: 2012-08-13
I have a URL I'm saving to a DB and want to display as a clickable link on a Gridview. I want the text of the link to be "View Form" and the URL to be the value pulled back from the DB. Anyone know how to do this? Here is what I got, but is not working:

<asp:HyperLinkField DataNavigateUrlFields="FormURL" DataNavigateUrlFormatString="http://{0}"
                            HeaderText="Form URL" SortExpression="FormURL" Target="_blank" DataTextField="FormURL" />
0
Comment
Question by:strickdd
  • 2
  • 2
4 Comments
 
LVL 12

Expert Comment

by:Pra4444
ID: 17814396
<asp:Hyperlink runat="server" Text='View Form' NavigateUrl='<%#"http://" & Server.UrlEncode(Container.DataItem("fieldname"))%>' ID="Hyperlink1" Target="_new" Enabled=True/>
0
 
LVL 28

Author Comment

by:strickdd
ID: 17819703
That doesn't work in the gridview. It says:

Error      1      System.Web.UI.WebControls.DataControlFieldCollection must have items of type 'System.Web.UI.WebControls.DataControlField'. 'asp:Hyperlink' is of type 'System.Web.UI.WebControls.HyperLink'.      C:\Inetpub\wwwroot\ScienceFair\Admin\SpecialConditions.aspx      19      
0
 
LVL 12

Accepted Solution

by:
Pra4444 earned 500 total points
ID: 17819733
are you putting them under template column??

here is an example..

http://www.eggheadcafe.com/community/aspnet/6/10004766/passing-parameters-from-g.aspx
0
 
LVL 28

Author Comment

by:strickdd
ID: 17835573
That's closer to what I need. However, in the DB i'm storing something like:

FormURL = "www.somewhere.com/page.pdf"

I need this value from the DB to be the location of the link that says "View".
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now