• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1583
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

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