Only one dynamic parameter can be specified for the DataGrid hyperlink column that comes with. net, which can be improved in the following ways:
First, bind the backend:
Private void mygrid_ItemDataBound (object sender, DataGridItemEventArgs e)
...{
If (e. Item. ItemType = ListItemType. Item | e. Item. ItemType = ListItemType. AlternatingItem)
...{
HyperLink link = (HyperLink) e. Item. Cells [0]. Controls [0];
String url = link. NavigateUrl;
Url + = "? Id = "+ e. Item. Cells [1]. Text +" & id2 = "+ e. Item. Cells [2]. Text;
Link. NavigateUrl = url;
}
}
Type 2: Add a template column to the foreground:
<Asp: TemplateColumn HeaderText = "test">
<ItemTemplate>
<Asp: HyperLink runat = "server" Text = '<% # DataBinder. eval (Container, "DataItem. productID ") %> 'navigateurl = '<% # DataBinder. eval (Container, "DataItem. productName "," detailspage. aspx? Id = {0} & id2 = "+ DataBinder. Eval (Container," DataItem. productID ") %> '>
</Asp: HyperLink>
</ItemTemplate>