topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday December 13, 2024, 9:46 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Help C# ASPX Database/dropdown error  (Read 3536 times)

Davidtheo

  • Participant
  • Joined in 2008
  • *
  • Posts: 119
    • View Profile
    • Donate to Member
Help C# ASPX Database/dropdown error
« on: May 18, 2009, 01:39 AM »
I have a drop Download list that is being filled from a database:

My ASPX.cs file
        myDataAdapter.Fill(myDataSet, "country,country_id");

        DropDownList1.DataSource = myDataSet;
        DropDownList1.DataValueField = "country_id";
        DropDownList1.DataTextField = "country";
        DropDownList1.DataBind();

my APSX File
<asp:ScriptManager ID="ScriptManager1" runat="server">
                                </asp:ScriptManager>
                                <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
                                    </asp:DropDownList><br /><br />
                                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                    <ContentTemplate>
                                       
                                        Adderss: label stuff
                                        Adderss: label stuff
                                    </ContentTemplate>
                                    <Triggers>
                                        trigger stuff
                                    </Triggers>
                                </asp:UpdatePanel>

when I select something from the drop down list a access the database again but no matter how many items are in the dropdown I get return a value of 1 from this code
My ASPX.cs file
database stuff
        int place = Convert.ToInt32(DropDownList1.SelectedValue);
        String strSQL = database select using place

Can someone please help me?