To access the HyperLinkField control with the RowDataBound event of the GridView, we can use the following code (refer the column cell)
protected void gridCaseMember_RowDataBound(object sender, GridViewRowEventArgs e){
if (e.Row.RowType == DataControlRowType.DataRow){
HyperLink myLink = (HyperLink)e.Row.Cells[0].Controls[0];
myLink.NavigateUrl = “http://www.bing.com”; }
}
http://forums.asp.net/t/1142271.aspx
Hope it helps !
Discover more from Nishant Rana's Weblog
Subscribe to get the latest posts sent to your email.

it throws exception
HyperLink myLink = (HyperLink)e.Row.Cells[0].Controls[0];
unable to cast??
LikeLike
Thanks! It worked in one go 🙂
LikeLike
am trying to do the same , without hyperlinkfield , am using hyperlink control,within a templatefield and trying to access the hyperlink column and when populated in the page, i need to see the link so that user clicked on the link, user should navigate to the targetted url.
LikeLike