Step-1 : First bind your GridView using SqlDataSource control
Step-2 : Select 'Edit Column' link using show smart tag.
Step-3 : Now, Appear new field window, which is contain two pane (left or right).
Step-4 : Remove All selected field in left pane.
Step-5 : Add new HyperLink field From Left pane.
Step-6: After Added Hyperlink field , you can set DataTextField and DataNavigationUrl field property from right pane.
Step-7 : Click ok
Step-8: Run You application
Step-2 : Select 'Edit Column' link using show smart tag.
Step-3 : Now, Appear new field window, which is contain two pane (left or right).
Step-4 : Remove All selected field in left pane.
Step-5 : Add new HyperLink field From Left pane.
Note : Assign Table column name to DataTextField and DataNavigationUrlField.
Step-8: Run You application
Code Generate the following output
Generated Code are:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="int" DataSourceID="SqlDataSource1" GridLines="None" Width="43px">
<Columns>
<asp:HyperLinkField DataNavigateUrlFields="address" DataTextField="name"
Text="Fav. Links" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>"
SelectCommand="SELECT * FROM [Table1]"></asp:SqlDataSource>
</form>
</body>
</html>