Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dynamic hyperlinking from datagrid
Message
De
26/03/2004 17:09:34
 
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
00889976
Message ID:
00890099
Vues:
21
Chris:

Thank you for pointing me in the right direction! It worked with a few minor modifications:
private void grdPermits_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
		{
			// Get a reference to the hyperlink in the 1st column
			if (e.Item.Cells[0].Controls.Count == 1)
			{
				HyperLink hlink = (HyperLink)e.Item.Cells[0].Controls[0];
				hlink.NavigateUrl = "http://www.northernlightssoftware.com";
			}
			//hlink.NagivateURL = "MyPage.aspx";
		}
Thanks again for your help!

Pertti



>You can change the hyperlink in the datagrid by using the ItemDataBound method of the datagrid (in C#):
>
>
>private void myDataGrid_ItemDataBound(object sender, System.Web.UI.DataGridItemEventArgs e)
>{
>  // Get a reference to the hyperlink in the 4th column
>  HyperLink hlink = (HyperLink)e.Items.Cells[3].Controls[0];
>
>  hlink.NagivateURL = "MyPage.aspx";
>}
>
>
>
>>I am trying to make a dynamic link from datagrid hyperlink to one of three possible URL's. Where it needs to go depends on the setting of an optiongroup on the datagrid's page. So, for example, if optiongroup value = 1, go to www.mysite1.com, if it is 2, go to www.mysite2.com, and so on.
>>
>>Since I don't have access to the URL address on the grid's hyperlink column (or do I?), I was thinking of using a redirect -page that picks up a value and routes the request to the appropriate web page, but that seems too kludgey.
>>
>>How would you do it?
>>
>>
>>Pertti
Pertti Karjalainen
Product Manager
Northern Lights Software
Fairfax, CA USA
www.northernlightssoftware.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform