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” />

<asp:HyperLinkField
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.