Skip to main content
Updated
Source Link
Gaurravs
  • 3.6k
  • 12
  • 23
  • 33

Make sure you write dropdown change event. Keep autopostback property to true.

In dropdown change event of your dropdown write below code.

protected void DropDownList4_SelectedIndexChanged(object sender, EventArgs e)
        {
                Label1.Text = DropDownList4.SelectedItem.Text;
        }

This will show display value of selected choice

You can also use:

  Label1.Text = DropDownList4.SelectedItem.Value;

This will show value (not display value) of selected choice

Your HTML block should look like:

<asp:DropDownList ID="DropDownList4" runat="server" Height="22px" AutoPostBack="true" OnSelectedIndexChanged="DropDownList4_SelectedIndexChanged"> </asp:DropDownList>

Make sure you write dropdown change event. Keep autopostback property to true.

In dropdown change event of your dropdown write below code.

Label1.Text = DropDownList4.SelectedItem.Text;

This will show display value of selected choice

You can also use:

  Label1.Text = DropDownList4.SelectedItem.Value;

This will show value (not display value) of selected choice

Make sure you write dropdown change event. Keep autopostback property to true.

In dropdown change event of your dropdown write below code.

protected void DropDownList4_SelectedIndexChanged(object sender, EventArgs e)
        {
                Label1.Text = DropDownList4.SelectedItem.Text;
        }

This will show display value of selected choice

You can also use:

  Label1.Text = DropDownList4.SelectedItem.Value;

This will show value (not display value) of selected choice

Your HTML block should look like:

<asp:DropDownList ID="DropDownList4" runat="server" Height="22px" AutoPostBack="true" OnSelectedIndexChanged="DropDownList4_SelectedIndexChanged"> </asp:DropDownList>

Source Link
Gaurravs
  • 3.6k
  • 12
  • 23
  • 33

Make sure you write dropdown change event. Keep autopostback property to true.

In dropdown change event of your dropdown write below code.

Label1.Text = DropDownList4.SelectedItem.Text;

This will show display value of selected choice

You can also use:

  Label1.Text = DropDownList4.SelectedItem.Value;

This will show value (not display value) of selected choice