Get selected item from asp:dropdownlist (C#) : DropDownList « Asp Control « ASP.Net

Get selected item from asp:dropdownlist (C#)

<script runat="server" language="C#">
  void Page_Load()
      if (Page.IsPostBack) {   
          Message.Text = "You have selected " + list1.SelectedItem.Value;
    <title>Drop Down List Example</title>
    <asp:label id="Message" runat="server"/> 
    <br />
    <form runat="server">
    Which city do you wish to look at hotels for?<br /><br />
    <asp:dropdownlist id="list1" runat="server">
    <br /><br /><br /><br />
    <input type="Submit">


Related examples in the same category

1.Set selected Item in asp:DropDownList (
2.On selected state changed in asp:dropdownlist (
3.Change background color for asp:dropdownlist (
4.Create asp:dropdownlist dynamically (
5.Set asp:DropDownList selected index (
6.Sort array elements and add them to the asp:dropdownlist (
7.Add elements in an Array to asp:dropdownlist (
8.Set asp:dropdownlist value statically (
9.Add value to asp:DropDownList dynamically (
10.Add values to asp:DropDownList (
11.Selected Index Changed event for asp:DropDownList (
12.Select the value of asp:DropDownList Selected Item (
13.Get form data: asp:checkbox, asp:DropDownList, asp:TextBox (
14.Change asp:dropdownlist fore and background color (
15.Set font name, size and style for asp:dropdownlist (
16.For loop controlled by dropdownlist (C#)
17.Use ArrayList to fill dropdown value (C#)
18.Working with the DropDownList Control and asp:SqlDataSource
19.Add ListItem to DropDownList
20.Appending Data Items
21.Depending Dropdowns
22.Dropdownlist Binded to ArrayList