[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 249
  • Last Modified:

Unbound ASP.net Drop List

I have an unbound asp.net drop list with items on the list of:

First
Second
Third
Fourth

If the user selects "Second" this value goes into a text box.  
The item shown on the drop list remains "Second".
How do I get the list to refresh so that the first item is shown after the user's selection.

I am useing vb.net.
0
jordanhelen
Asked:
jordanhelen
  • 3
1 Solution
 
Carlos VillegasFull Stack .NET DeveloperCommented:
Hello, using your DropDownList SelectedIndexChanged event and the SelectedIndex property, example:
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
    MyTextBox.Text = DropDownList1.SelectedValue;
    DropDownList1.SelectedIndex = 0;
}

Open in new window

0
 
Carlos VillegasFull Stack .NET DeveloperCommented:
Sorry, VB.NET:
Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
    MyTextBox.Text = DropDownList1.SelectedValue
    DropDownList1.SelectedIndex = 0
End Sub

Open in new window

0
 
Carlos VillegasFull Stack .NET DeveloperCommented:
DropDownList1.SelectedIndex = 0 will select the first item of your List
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now