I am new with ASP.Net and C#. I have problem with drop down list. How to declare drop down list and how to save user selection from drop down list into SQL database using C# ?

To get the selected item from a dropdownlist you do this.

String selectedItem = DropDownList1.SelectedItem.Value;

now if you want to save that value right after the user change selection you have to set autopostback property in the dropdownlist to true and under the OnselectedIndexChanged event create your procedure to save that value in the database.

regards

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.