How to Get a Value From ASP Dropdownlist
The ASP.NET ComboBox class creates a drop-down list your readers use to select a value. When the user clicks the form's "Submit" button, all selected values and text entered in the form are sent to the ASP.NET processing page. You use the ComboBox "Text" property to retrieve the value of the selected drop-down list.
Instructions
-
-
1
Click the Windows "Start" button, and type "Visual Studio" in the search text box. Press "Enter" to open the ASP.NET editor. Open the ASP.NET project.
-
2
Double-click the processing page in the VS Solution Explorer panel on the right side of the work space. The code file opens in the editor.
-
-
3
Type the code that gets the value from the drop-down list. The following code retrieves a value from a drop-down list named "colors":
string input = string.Empty;
input = colors.Text;In this example, the value chosen by the user is stored to the "input" variable.
-
1