- Back to Home »
- ASP.NET »
- C# Asp.net dropdown control get value text selected by user
Posted by :
Sudhir Chekuri
Thursday, 24 July 2014
to get selected value from the dropdown list to use it in your C# code using the below code
int i= Convert.ToInt32(DDLCity.SelectedValue);
In my example the value is a number and i want to store it in int variable.
To display text selected in dropdownlist in asp.net label i used the below C# code
LblCity.Text= DDLCity.SelectedItem.Text;
int i= Convert.ToInt32(DDLCity.SelectedValue);
In my example the value is a number and i want to store it in int variable.
To display text selected in dropdownlist in asp.net label i used the below C# code
LblCity.Text= DDLCity.SelectedItem.Text;