Live Chat Icon For mobile
Live Chat Icon

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 ;

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.