Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 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 January 9th, 2006, 02:37 AM
Registered User
 
Join Date: Jan 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Pass TWO NameValuePairs by Datagrid Hyperlink Col

Is there a way I can pass two name value pairs using Datagrid's Hyperlink column which is bound to a database. I can pass one of pairs using

DataNavigateUrlFormatString= "add_sub_division.aspx?id={0}"
When clicked this would open url something like

    localhost/abc/add_sub_division.aspx?id=5

But what if i wanted to pass another name value pairs like

    localhost/abc/add_sub_division.aspx?id=5&another_id=2
So essentially the question is how can i change the value of DataNavigateUrlFormatting at RUNTIME.




 
Old January 13th, 2006, 05:05 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Unfortunately not. This is a limitation to the hyperlink column. You'll have to use a template column and construct the hyperlink yourself with all the data in it you need.

-Peter
 
Old January 16th, 2006, 10:51 AM
Authorized User
 
Join Date: Dec 2005
Posts: 77
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to g_vamsi_krish
Default

u can assign hyper link to the particular filed or column

for this u need to intililize datagrid as follows

this.DataGridName.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler (this.DataGridName_ItemDataBound);

In the function ItemDataBound u can assign hyper link.

private void DataGridName_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
    HyperLink viewItemUsageLink = (HyperLink)e.Item.FindControl ("DataGridColumnName"); // DataGridColumnName -- this is the hyper link column name that u want to assign URL.

viewItemUsageLink .NavigateUrl = "url/yourURl.aspx"
viewItemUsageLink .NavigateUrl += "?param=" + value + "&parm1=" +value1; // like this u can assign any thing
}

Check weather it satisfies u.

vamsi




vamsi
 
Old January 17th, 2006, 12:36 AM
Registered User
 
Join Date: Jan 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by g_vamsi_krish
 u can assign hyper link to the particular filed or column

for this u need to intililize datagrid as follows

this.DataGridName.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler (this.DataGridName_ItemDataBound);

In the function ItemDataBound u can assign hyper link.

private void DataGridName_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
    HyperLink viewItemUsageLink = (HyperLink)e.Item.FindControl ("DataGridColumnName"); // DataGridColumnName -- this is the hyper link column name that u want to assign URL.

viewItemUsageLink .NavigateUrl = "url/yourURl.aspx"
viewItemUsageLink .NavigateUrl += "?param=" + value + "&parm1=" +value1; // like this u can assign any thing
}

Check weather it satisfies u.

vamsi




vamsi
Yes after a little bit of tweaking it is giving the required result, thnks for the reply.

asrar

 
Old January 17th, 2006, 04:48 PM
Authorized User
 
Join Date: Dec 2005
Posts: 77
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to g_vamsi_krish
Default

U r WELCOME

vamsi





Similar Threads
Thread Thread Starter Forum Replies Last Post
hyperlink in a datagrid? bhavna General .NET 1 January 25th, 2007 12:37 PM
Pass an SQL row using hyperlink mawoodall Classic ASP Basics 19 May 31st, 2006 07:27 PM
DataGrid's hyperlink and customized col Problem naresh.net ASP.NET 1.0 and 1.1 Basics 9 June 30th, 2005 07:23 AM
How do you make a Data Grid Hyperlink Column pass KarmenC ASP.NET 1.x and 2.0 Application Design 5 January 13th, 2005 11:43 AM
DataGrid hyperlink Tangerine ASP.NET 1.x and 2.0 Application Design 2 March 24th, 2004 01:04 AM





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