How to enable/disable a succeeding dropdown list if a value is selected on the first drop down list

Posted on 2009-12-21
Last Modified: 2012-05-08
Hello experts,
I'm interested in dynamic Drop down list. Let's say i've got three drop down list...
DDL1 - Yes/No
DDL2 - SQLDatasource
DDL3 - SQLDatasource
The condition/s are ...
IF DDL1 selected value is 'Yes' (Postback) DDL2 will be active and DDL3 is disabled.
IF DDL1 value is 'No' (Postback) DDL2 will be disabled and DDL3 is enabled.
Is this possible? Any code suggestion/s or links is much appreciated.
Question by:jsuanque
    LVL 9

    Accepted Solution

           <asp:DropDownList ID="DropDownList1" autopostback="true" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
                if (String.Compare(DropDownList1.SelectedValue, "Yes", true) == 0)
                    DropDownList2.Enabled = true;
                    DropDownList3.Enabled = false;
                    DropDownList2.Enabled = false;
                    DropDownList3.Enabled = true;

    Open in new window


    Author Closing Comment

    by:jsuanque like charm. Thanks.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

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

    Suggested Solutions

    Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
    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…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    779 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

    11 Experts available now in Live!

    Get 1:1 Help Now