How to use HyperLinkField in DetailsView in asp.net

DetailsView HyperLinkField
DetailsViewHyperLinkFieldExample.aspx

<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>asp.net asp:HyperLinkField example: how to use HyperLinkField in DetailsView</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Navy">DetailsView HyperLinkField Example</h2>
        <asp:Label ID="Label1" runat="server" Font-Italic="true" ForeColor="Red"></asp:Label>
        <asp:SqlDataSource 
            ID="SqlDataSource1"
            runat="server"
            ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            SelectCommand="SELECT CategoryID, CategoryName, Description FROM Categories"
            >
        </asp:SqlDataSource>
        <asp:DetailsView 
            ID="DetailsView1"
            runat="server"
            DataSourceID="SqlDataSource1"
            AllowPaging="true"
            ForeColor="AliceBlue"
            BackColor="DodgerBlue"
            BorderColor="LightSkyBlue"
            AutoGenerateRows="false"
            >
            <Fields>
                <asp:BoundField HeaderText="Category ID" DataField="CategoryID" />
                <asp:BoundField HeaderText="Category Name" DataField="CategoryName" />
                <asp:BoundField HeaderText="Description" DataField="Description" />
                <asp:HyperLinkField HeaderText="Category Details" DataNavigateUrlFields="CategoryID" DataNavigateUrlFormatString="~/CategoryDetails.aspx?CategoryID={0}" DataTextField="CategoryName" />
            </Fields>
            <HeaderTemplate>
                <b>Category List</b>
            </HeaderTemplate>
            <HeaderStyle BackColor="DarkBlue" />
        </asp:DetailsView>        
    </div>
    </form>
</body>
</html>
CategoryDetails.aspx

<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Category Details Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Navy">Category Details</h2>
        <asp:SqlDataSource 
            ID="SqlDataSource1"
            runat="server"
            ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            SelectCommand="SELECT ProductID, ProductName, UnitPrice FROM Products WHERE CategoryID=@CategoryID"
            >
            <SelectParameters>
                <asp:QueryStringParameter Name="CategoryID" QueryStringField="CategoryID" />
            </SelectParameters>
        </asp:SqlDataSource>
        <asp:GridView 
            ID="GridView1"
            runat="server"
            DataSourceID="SqlDataSource1"
            AllowPaging="true"
            ForeColor="AliceBlue"
            BackColor="DodgerBlue"
            BorderColor="LightSkyBlue"
            HeaderStyle-BackColor="DarkBlue"
            >
        </asp:GridView>        
    </div>
    </form>
</body>
</html>
More asp.net examples