Solved

hyperlink column in my gridview

Posted on 2010-09-02
3
754 Views
Last Modified: 2012-05-10
I have grid view in which I want the last column to be a hyperlink. and the querystring for that link is the going to be the value of the first column of the gridview.  so the link should be something like
service.aspx?service="whatever the value is from the first column". the text of that hyperlink should be "View". How can I accomplish this?


I am populatating the grid by creating a datatable in my code and then binding the grid with that datatable.
<asp:BoundField DataField="servicename" HeaderText="Service" />

<asp:BoundField DataField="New" HeaderText="New" />

<asp:BoundField DataField="Old_Amount" HeaderText="Old Budget" />

<asp:BoundField DataField="New_Amount" HeaderText="New Budget" />

<asp:BoundField DataField="Difference" HeaderText="Difference" />

<asp:BoundField HeaderText="Notes/Attachments" />

<asp:HyperLinkField Text should be "View" url should be \service.aspx?servicename= value from the first column/>

Open in new window

0
Comment
Question by:pratikshahse
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
OBonio earned 250 total points
ID: 33588992
Something like this :

<asp:HyperLinkField Text="View" DataNavigateUrlFields="servicename" DataNavigateUrlFormatString="service.aspx?service={0}" />
0
 
LVL 6

Assisted Solution

by:nipunu
nipunu earned 250 total points
ID: 33594576
<asp:hyperlinkfield headertext="View"  datatextfield="View" datanavigateurlfields="servicename"
      datanavigateurlformatstring="service.aspx?service={0}" />

0
 
LVL 6

Expert Comment

by:nipunu
ID: 33594581
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

863 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

25 Experts available now in Live!

Get 1:1 Help Now