Saturday, September 3, 2011

ASP.Net-Select particular item in dropdown list

Item in a dropdown list can be selected by using either of the following lines:

  • DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByText(<Enter here Text>));
  • DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByValue(<Enter here value>));

No comments:

Post a Comment

How to add the .NET MAUI App Accelerator in Visual Studio

 To add the .NET MAUI App Accelerator in Visual Studio, follow these steps: Prerequisites: Ensure you have Visual Studio 2022 (17.3 or lat...