Solved

hyperlink column in my gridview

Posted on 2010-09-02
3
760 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
[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
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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.…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…
Suggested Courses

739 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