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.
Unfortunately, activation email could not send to your email. Please try again.

Enable a disabled dropdownlist based off onchange event

Thread ID:

Created:

Updated:

Platform:

Replies:

131523 Jul 14,2017 10:13 AM Jul 17,2017 03:07 AM ASP.NET Core 1
loading
Tags: DropDownList
Jacob Knight
Asked On July 14, 2017 10:13 AM

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?

Prince Oliver [Syncfusion]
Replied On July 17, 2017 03:07 AM

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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;