ASP.NET SqlDataSource SelectCommandType Text and StoredProcedure

SqlDataSource SelectCommandType Text and StoredProcedure
UsingSelectCommandTypeBoth.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>SqlDataSource SelectCommandType Text and StoredProcedure using in a asp.net page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Navy; font-style:italic;">SqlDataSource Example: SelectCommandType StoredProcedure and Text</h2>
        <asp:SqlDataSource 
            ID="SqlDataSource1"
            runat="server"
            ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            SelectCommandType="Text"
            SelectCommand="Select categoryID, CategoryName From Categories"
            >
        </asp:SqlDataSource>
        <asp:Label 
            ID="Label1"
            runat="server"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            Text="Select category"
            >
        </asp:Label>
        <asp:DropDownList 
            ID="DropDownList1"
            runat="server"
            DataSourceID="SqlDataSource1"
            DataValueField="CategoryID"
            DataTextField="CategoryName"
            AutoPostBack="true"
            ForeColor="Snow"
            BackColor="Crimson"
            >
        </asp:DropDownList>
        <br /><br />
        <asp:SqlDataSource 
            ID="SqlDataSource2"
            runat="server"
            ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            SelectCommand="GetProductsByCategoryID"
            SelectCommandType="StoredProcedure"
            >
            <SelectParameters>
                <asp:ControlParameter ControlID="DropDownList1" PropertyName="SelectedValue" Name="CategoryID" />
            </SelectParameters>
        </asp:SqlDataSource>
        <asp:GridView 
            ID="GridView1"
            runat="server"
            DataSourceID="SqlDataSource2"
            AutoGenerateColumns="true"
            AllowPaging="true"
            PageSize="10"
            BorderColor="Salmon"
            Font-Names="Comic Sans MS"
            Width="650"
            >
            <HeaderStyle BackColor="IndianRed" ForeColor="Snow" Height="45"/>
            <RowStyle BackColor="DarkSalmon" ForeColor="Snow" Font-Italic="true" />
            <PagerStyle 
                Height="45" 
                HorizontalAlign="Right" 
                BackColor="RosyBrown"
                Font-Bold="true"
                Font-Size="X-Large"
                ForeColor="Snow"
                />
            <PagerSettings Mode="Numeric" />
        </asp:GridView>
    </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