ASP Dropdown Passing Databound selection value

Hi,

I have created an ASP dropdown, and used the wizard to bind the data to the list.  Now, I want to pass the result back so that I may use it in the codebehind, but I dont know how to do this.

See my aspx code here:  My Codebehind is attached below.  I need to pass the selection in the "Submit" function.

<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1"
        DataTextField="FullName" DataValueField="Personel_ID" Height="27px"
        Width="218px" AutoPostBack="True"
        onselectedindexchanged="DropDownList1_SelectedIndexChanged"
        AppendDataBoundItems="True">
<asp:ListItem Text="(All)" Value="defaultValue" Selected="true"></asp:ListItem>

</asp:DropDownList>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConnectionString="ConnectionString">
    </asp:SqlDataSource>
protected void submit(object sender, EventArgs e)
        {
            Class1 c1 = new Class1();
            DateTime FromDate= DateTime.Parse(Request.Form[TextBox1.UniqueID]);
            DateTime toDate = DateTime.Parse(Request.Form[TextBox2.UniqueID]);
            
            
            IDataReader reader = c1.getData(FromDate, toDate, FullName);
             GridView1.DataSource = reader;
             GridView1.DataBind();

Open in new window

NerishaBAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Pratima PharandeCommented:
On the same page on button event you will get selected values using

DropDownList1.SelectedItem.value
Pratima PharandeCommented:
In your casetry like thi s

string str = HttpContext.Current.Request.Form[varDropDownList.UniqueID];

or

string str = Request.Form[varDropDownList.UniqueID];
Pratima PharandeCommented:
In your casetry like thi s

string str = HttpContext.Current.Request.Form[DropDownList1.UniqueID];

or

string str = Request.Form[DropDownList1.UniqueID];

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NerishaBAuthor Commented:
Thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.