Get SelectedValue at SelectedIndex in DropDownList

2019-09-04 16:59发布

问题:

Is this possible? I programatically change the selected index when a certain event is fired using this code:

DropDownList.SelectedIndex = DropDownList.SelectedIndex + 1

Now I want to update a corresponding textbox with the text that is in the new SelectedIndex of the DropDownList via postback.

What's the easiest way to do this?


I know how I can do this in javascript.... I was just wondering if i could do this in the VB code behind.

回答1:

TextBox.Text = DropDownList.SelectedValue;

Read more about ListControl.SelectedValue