[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1576
  • Last Modified:

set dropdown list value



I have a dropdown list that is bound to a dataset. It has the months of the year returned from a stored procedure that executes to fill it.

I want it to default to one of these values depending on what month it is.

For instance if it's june I want it to default to june.

How do I set the default value for the dropdown list?

0
jlazanowski
Asked:
jlazanowski
1 Solution
 
Maulik ModiCommented:
Hi  jlazanowski,

AFter filling the dropdown, select any value based on one of the follwoing methods....If you are displaying months in dropdown then use findbytext else the other one..

//Fill dropdwon list box here:
..databind()

//Select dropdown value:
DropDownList1.Items.FindByText("text here").Selected=true;
DropDownList1.Items.FindByValue("value here").Selected = true;

Regards.
MaulikCE
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now