Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Gridview HyperLinkField

Posted on 2006-10-26
4
Medium Priority
?
725 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

688 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