How to select a specific Item in a DropDownList

Platform: ASP.NET|Category: Dropdownlist

Method 1:
VB.NET

DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByValue(<value>))
’DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByText(<Text>))

C#

DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByValue(<value>));
//DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByText(<Text>));

Method 2:
VB.NET

DropDownList1.Items.FindByText('<Text>').Selected = true
’DropDownList1.Items.FindByValue('<value>').Selected = true

C#

DropDownList1.Items.FindByText('<Text>').Selected = true ;
//DropDownList1.Items.FindByValue('<value>').Selected = true ;