p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Professional (http://p2p.wrox.com/forumdisplay.php?f=215)
-   -   Hyperlinks in GridView Columns (http://p2p.wrox.com/showthread.php?t=50253)

monika.oberoi November 14th, 2006 01:00 AM

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.


nitinp November 14th, 2006 08:43 AM

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 + ")";
 }
}


akhilhp December 22nd, 2006 04:21 AM

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.


All times are GMT -4. The time now is 02:42 AM.

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