We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Enable a disabled dropdownlist based off onchange event

I have a group of dropdownlists but I'm not utilizing grouping. I've been looking @ the documentation and haven't seen any examples of enabling a ddl as part of the process of selecting from an initial dropdownlist. This is the format I'm using:

        <ej-drop-down-list id="projectsList" width="350px" height="25px" show-rounded-corner="true" watermark-text="Select Project" enable-persistence="true">
            <e-datamanager id="Projects" json="ViewBag.Projects"></e-datamanager>
            <e-drop-down-list-fields text="project" id="id" value="id" />
        </ej-drop-down-list>

I'm guessing this can be done with the onchange event & Javascript but just wanted validation or to see if something else is required?

1 Reply

PO Prince Oliver Syncfusion Team July 17, 2017 07:07 AM UTC

Hi Jacob,   
  
Thank you for contacting Syncfusion Support.   
  
Yes, we can enable the second dropdownlist when a value is selected in the first dropdownlist using change event. Kindly refer to the following code snippet.   

<div class="col-xs-8 col-sm-4"> 
    <span class="txt">Select Group</span> 
    <ej-drop-down-list id="groupsList" datasource="ViewBag.datasource"  change="onChange" watermark-text="Select"> 
        <e-drop-down-list-fields value="parentId" text="text" /> 
    </ej-drop-down-list> 
</div> 
<div class="col-xs-8 col-sm-4" > 
    <span class="txt">Select Country</span> 
    <ej-drop-down-list id="countryList" datasource="ViewBag.datasource1" enabled="false"></ej-drop-down-list> 
</div> 
<script type="text/javascript"> 
    function onChange() { 
        var ctry = $('#countryList').data("ejDropDownList"); 
        ctry.enable(); 
    } 
</script> 

  
If you are looking for a Cascading property, Kindly refer to the following UG link : https://help.syncfusion.com/aspnet-core/dropdownlist/functionalities#cascading 
  
Kindly refer to the following link for online demo sample: http://aspnetcore.syncfusion.com/dropdownlist/cascading 

Regards,   
Prince 


Loader.
Up arrow icon