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)
{
if (e.Item.Cells[0].Controls.Count == 1)
{
HyperLink hlink = (HyperLink)e.Item.Cells[0].Controls[0];
hlink.NavigateUrl = "http://www.northernlightssoftware.com";
}
}
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