Then instead of doing it inline, use the code behind.
After I sent that reply I tried it and got a the same problem. Rather than figure out the right way form the tag, I swithced to using the code behind and it worked perfectly.
To the DataGird, add the following
<asp:DataGrid OnItemDataBound="PortProvGrid_ItemDataBound" ID="PortProvGrid" GridLines="Both" runat="server" AutoGenerateColumns="False" Visible="True" Width="728px">
In the code behind, if using C#, add this:
protected void gv2_RowDataBound(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
//this makes sure we only apply this to rows that have data
{
DataRowView drv = (DataRowView)e.Item.DataItem;
HyperLink hl = (HyperLink)e.Item.FindControl("hlThumbnails");
hl.NavigateUrl="javascript:var w=window.open('authorizationform.aspx?ID=" + drv["ID"].ToString() + "')";
}
}
If you're using VB, then search MSDN for "DataGridItem ItemDataBound" for the equivalent: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.datagriditem.dataitem.aspx
ALSO -- please note I use GridViews mostly, not datagrids, so I tried to make sure I got the syntax right for datagrids, but may have made a mistake. The above worked for me using a grdiview, so it should work with some modifications to a datagrid.