ASP.NET and C# get combo box value?

cthulhu

New member
How do i get the combo box value from my web-form and insert it into Database with SQL?
(For example country name from countries combo box)
In other words.. How can i store the selected value in combo-box in variable ?
I tried Request.Form["countries"] but no success
I also tried:
countries.SelectedItem.Value
but it is not working in CodeFile
protected void Page_Load(object sender, EventArgs e)
{
string country = countries.SelectedItem.Value;
}
(Compiler Error Message: CS1061: 'string' does not contain a definition for 'SelectedItem' and no extension method 'SelectedItem' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)
)
 
Back
Top