View Single Post
  #1 (permalink)  
Old July 19th, 2007, 02:51 PM
u2clone u2clone is offline
Authorized User
Join Date: Jul 2007
Location: Cumming, Ga, USA.
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to u2clone
Default Trying to do a sql web query/filter

OK, I am new to most all of this, but have taught myself enough to get to this point and get stuck. I am using c# and accessing a SQL 2005 DB.

I have a search feature on the home page similar to what is on the website where the user selects a few things, hits the submit button and then is taken to a new page with the matching results.

Here is what I have for the "Search" form so far
        <form id="Form2" runat="server" method="post">
            Country:<br />
                <asp:DropDownList ID="Country_Select" runat="server" DataSourceID="SqlDataSource1" DataTextField="Country" DataValueField="CountryID" Width="160px" ></asp:DropDownList>
            <br />
            State: (if Country selected is the United States)<br />
                <asp:DropDownList ID="State_Select" runat="server" DataSourceID="SqlDataSource2" DataTextField="State" DataValueField="StateID" Width="160px"></asp:DropDownList>
            <br />
            Price Range:<br />
                <asp:DropDownList ID="Price_Select" runat="server" DataSourceID="SqlDataSource3" DataTextField="PriceRange" DataValueField="PriceID" Font-Names="arial" Font-Size="9pt" Font-Bold="true" Width="160px"></asp:DropDownList>
            <br />
            <asp:Button ID="Button1" runat="server" Width="151px" OnClick="SearchTest" />


    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Database2 %>"
        SelectCommand="SELECT * FROM [Lux_Country]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:Database2 %>"
        SelectCommand="SELECT * FROM [Lux_States]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:Database2 %>"
        SelectCommand="SELECT * FROM [Lux_Price]"></asp:SqlDataSource>

How do I get the three variables to carry to the new page and what do I need to do for it to pick them up as well?

I'm lost and have tried many things to no avail, but this is what I get for teaching myself I guess. This is why I am not posting the codebehind as well. I can't find a matching example in my ASP.NET 2.0 with C# book.


\"Freedom is the right of all sentient beings\" - Optimus Prime
Reply With Quote