How to use QueryStringParameter in asp.net

QueryStringParameter
Default.aspx

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

<!DOCTYPE html>

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>How to use QueryStringParameter</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Red">QueryStringParameter Example</h2>
        <asp:HyperLink
             ID="HyperLink1"
             runat="server"
             NavigateUrl="~/QueryStringParameterExample.aspx?QSProductID=1"
             Text="Click for product details: Chai"
             Font-Size="Large"
             >
        </asp:HyperLink>
    </div>
    </form>
</body>
</html>
QueryStringParameterExample.aspx

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

<!DOCTYPE html>

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>asp.net QueryStringParameter example: how to use asp:QueryStringParameter</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Navy">QueryStringParameter How To Use</h2>
        <asp:SqlDataSource
             ID="SqlDataSource1"
             runat="server"
             ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
             DataSourceMode="DataReader"
             SelectCommand="SELECT ProductID, ProductName, UnitPrice FROM Products WHERE ProductID=@ProductID"
             >
             <SelectParameters>
                <asp:QueryStringParameter Name="ProductID" QueryStringField="QSProductID" />
             </SelectParameters>
        </asp:SqlDataSource>
        <asp:DetailsView
             ID="DetailsView1"
             runat="server"
             DataSourceID="SqlDataSource1"
             BackColor="HotPink"
             ForeColor="AliceBlue"
             >
        </asp:DetailsView>
    </div>
    </form>
</body>
</html>
Related asp.net examples