Solved

Gridview HyperLinkField

Posted on 2006-10-26
4
705 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

827 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