Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Gridview HyperLinkField

Posted on 2006-10-26
4
Medium Priority
?
729 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 1000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

824 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