Use GridView BoundField as hyperlink

Let’s say, You have UserId & UserName columns in a gridview. You can use UserName column as hyperlink. The code is following-

<asp:BoundField DataField=”UserId”
HeaderText=”User Id” />

DataTextField=”UserName”    //Datatable column name
DataNavigateUrlFields=”UserId”   //Value is taken from this field dynamically
DataNavigateUrlFormatString=”UserDetails.aspx?ID={0}”    //Page name with a place holder for dynamic data UserId
HeaderText=”User Name” />

Hyperlinked BoundField made easy.


Leave a Reply

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

You are commenting using your 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