With a dropdown list - you can dynamically select items in the list with a sort of 'built-in' find routine.To select a certain item, based on the Value of the item in the list:
DropDownList.SelectedIndex = DropDownList.Items.IndexOf(DropDownList.Items.FindByValue(YourValueHere)) To select a certain item, based on the Text of the item in the list: DropDownList.SelectedIndex = DropDownList.Items.IndexOf(DropDownList.Items.FindByText("YourTextHere")) OR - you can do it this way: DropDownList.Items.FindByText("TextYouAreLookingFor").Selected = true or, using the value of the item DropDownList.Items.FindByValue("ValueYouAreLookingFor").Selected = true


No comments:
Post a Comment