Solved

hyperlink column in my gridview

Posted on 2010-09-02
3
749 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
Comment Utility
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
Comment Utility
<asp:hyperlinkfield headertext="View"  datatextfield="View" datanavigateurlfields="servicename"
      datanavigateurlformatstring="service.aspx?service={0}" />

0
 
LVL 6

Expert Comment

by:nipunu
Comment Utility
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Paging GridView 7 32
Long URL in SMS 6 23
Hidden Field Value 10 34
Re-position the objects 7 46
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…
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 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

12 Experts available now in Live!

Get 1:1 Help Now