Tips and tricks for .NET using ASP and VB code.

Select an item in a dropdownlist via code

DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByValue("Value"))
DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByText("Text"))

No comments:

Post a Comment

Search This Blog