Wrox Programmer Forums
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 14th, 2006, 01:00 AM
Registered User
 
Join Date: Nov 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to monika.oberoi
Default Hyperlinks in GridView Columns

Hi
I am using one of the column of the gridview control as hyperlink field which is bounded to one the fields in the database.

I want to navigate the hyperlink to different URLs depending upon the value in that column of the gridview. Please make it sure that i am using this with gridview control in asp.net2.0 and not with datagrid as in asp1.0

Please reply.

 
Old November 14th, 2006, 08:43 AM
Authorized User
 
Join Date: Aug 2006
Posts: 39
Thanks: 1
Thanked 0 Times in 0 Posts
Default

hi there,

I hope this will help you.

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
 if (e.Row.RowType == DataControlRowType.DataRow)
 {
   HyperLink hlnk = (HyperLink)e.Row.Cells[0].Controls[1];
   hlnk.NavigateUrl = "javascript:getPage(" + hlnk.Text + ")";
 }
}

 
Old December 22nd, 2006, 04:21 AM
Authorized User
 
Join Date: Nov 2006
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to akhilhp
Default

What if I want to send the hyperlink text to a session variable whenever it is clicked. I tried many things but could not get any where.





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to freeze GridView columns? MLaGrange BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 1 September 16th, 2010 10:10 PM
Totaling columns in a footer row of a GridView psimonson ASP.NET 2.0 Basics 1 May 5th, 2008 01:34 PM
Adding columns to Gridview gagansharma7 ADO.NET 1 February 15th, 2008 10:54 AM
Need to get value of gridview template columns for kmh030 ASP.NET 2.0 Professional 1 January 6th, 2007 11:10 PM
hyperlinks sbhandar Classic ASP Basics 4 August 19th, 2004 09:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.