DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Help C# ASPX Database/dropdown error  (Read 4,404 times)

Davidtheo

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

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

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

my APSX File
Code
<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
Code
database stuff
        int place = Convert.ToInt32(DropDownList1.SelectedValue);
        String strSQL = database select using place

Can someone please help me?

Original address: https://www.donationcoder.com/forum/index.php?topic=18357.0