set dropdown list value

Posted on 2005-04-06
Last Modified: 2009-07-29

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?

Question by:jlazanowski
    1 Comment
    LVL 6

    Accepted Solution

    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:

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


    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
    This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now