ASP.NET - QueryStringParameter and StoredProcedure in SqlDataSource

Using QueryStringParameter and StoredProcedure in SqlDataSource
GridViewHyperLink.aspx

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
    
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Populating a GridView with Products Categoris data</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Navy; font-style:italic;">GridView Example: Using TemplateFiled</h2>
        <asp:SqlDataSource 
            ID="SqlDataSource1"
            runat="server"
            ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            SelectCommandType="Text"
            SelectCommand="Select categoryID, CategoryName From Categories"
            >
        </asp:SqlDataSource>
        <asp:GridView 
            ID="GridView1"
            runat="server"
            DataSourceID="SqlDataSource1"
            AutoGenerateColumns="false"
            AllowPaging="true"
            PageSize="10"
            BorderColor="Salmon"
            Font-Names="Comic Sans MS"
            Width="650"
            >
            <HeaderStyle BackColor="Crimson" ForeColor="Snow" Height="45"/>
            <RowStyle BackColor="Snow" ForeColor="Gray" Font-Italic="true" />
            <PagerStyle 
                Height="45" 
                HorizontalAlign="Right" 
                BackColor="RosyBrown"
                Font-Bold="true"
                Font-Size="X-Large"
                ForeColor="Snow"
                />
            <PagerSettings Mode="Numeric" />
            <Columns>
                <asp:TemplateField HeaderText="Category">
                    <ItemTemplate>
                        <a href="QueryStringParameterTest.aspx?CategoryID=<%# Eval("CategoryID") %>"><%# Eval("CategoryName") %></a>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
    </form>
</body>
</html>
QueryStringParameterTest.aspx

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
    
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Using QueryStringParameter and StoredProcedure in SqlDataSource</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Navy; font-style:italic;">SqlDataSource Example: QueryStringParameter and StoredProcedure</h2>
        <asp:SqlDataSource 
            ID="SqlDataSource1"
            runat="server"
            ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            SelectCommand="GetProductsByCategoryID"
            SelectCommandType="StoredProcedure"
            >
            <SelectParameters>
                <asp:QueryStringParameter Name="CategoryID" QueryStringField="CategoryID" />
            </SelectParameters>
        </asp:SqlDataSource>
        <asp:GridView 
            ID="GridView1"
            runat="server"
            DataSourceID="SqlDataSource1"
            AutoGenerateColumns="true"
            AllowPaging="true"
            PageSize="10"
            BorderColor="IndianRed"
            Font-Names="Comic Sans MS"
            Width="650"
            >
            <HeaderStyle BackColor="DeepPink" ForeColor="Snow" Height="45"/>
            <RowStyle BackColor="IndianRed" ForeColor="Snow" Font-Italic="true" />
            <PagerStyle 
                Height="45" 
                HorizontalAlign="Right" 
                BackColor="BurlyWood"
                Font-Bold="true"
                Font-Size="X-Large"
                ForeColor="Snow"
                />
            <PagerSettings Mode="Numeric" />
        </asp:GridView>
        <br />
        <a href="GridViewHyperLink.aspx">Go to category page</a>
    </div>
    </form>
</body>
</html>
GetProductsByCategoryID [StoredProcedure]

CREATE PROCEDURE [dbo].[GetProductsByCategoryID] 
@CategoryID int
AS

Select ProductID, ProductName, QuantityPerUnit, UnitPrice From Products
Where CategoryID=@CategoryID
More asp.net examples