HyperLinkField and RowDataBound in ASP.NET

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 !


Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

3 thoughts on “HyperLinkField and RowDataBound in ASP.NET”

    1. 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.

      Like

Share your thoughts

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s