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

How to Cascade DropDownListFor to other DropDownListFor?

Hi everybody!

When I'm trying cascade DDLF to another DDLF, I get "Uncaught ejDropDownList: methods/properties can be accessed only after plugin creation"

1 Reply

PO Prince Oliver Syncfusion Team January 9, 2017 09:23 AM UTC

Hi John,   
  
Thanks for contacting Syncfusion Support.   
  
We were unable to reproduce the console error, "Uncaught ejDropDownList: methods/properties can be accessed only after plugin creation" at our end. We have prepared a sample for cascading two DropDownListFor controls. Have a look at the below code snippet.   
  
View Code:   
<div class="col-xs-8 col-sm-4">   
            <span class="txt">Select Group</span>   
            @Html.EJ().DropDownListFor(model => model.auto1, (Syncfusion.JavaScript.Models.DropDownListProperties)ViewData["ddl"]).CascadeTo("Name").ClientSideEvents(e => e.Change("onChange")).WatermarkText("Select")   
        </div>   
        <div class="col-xs-8 col-sm-4">   
            <span class="txt">Select Country</span>   
            @Html.EJ().DropDownListFor(model => model.Name, (Syncfusion.JavaScript.Models.DropDownListProperties)ViewData["ddl1"]).Enabled(false)   
        </div>   
<script type="text/javascript">   
        function onChange() {   
            var ctry = $('#Name').data("ejDropDownList");   
            ctry.element.val("");   
        }   
    </script>   
  
  
Controller Code:   
public ActionResult DropdownlistFeatures()   
        {   
            DropDownListProperties ddl = new DropDownListProperties();   
            ddl.DataSource = GetDataSource();   
            DropDownListFields ddf = new DropDownListFields();   
            ddf.Text = "text";   
            ddf.Value = "parentId";   
            ddl.DropDownListFields = ddf;   
            ViewData["ddl"] = ddl;   
               
            DropDownListProperties ddl1 = new DropDownListProperties();   
            ddl1.DataSource = GetDataSource1();   
            DropDownListFields ddf1 = new DropDownListFields();   
            ddf1.Text = "text";   
            ddf1.Value = "value";   
            ddl1.DropDownListFields = ddf1;   
            ViewData["ddl1"] = ddl1;   
   
            return View();   
        }   
  
  
We have attached the sample for your convenience, refer to the following sample link:http://www.syncfusion.com/downloads/support/forum/128199/ze/DropdownlistForCascade746551743   
  
If the issue still persists, please provide an issue reproducing sample along with the replication steps. It will help us to isolate the root cause and provide a solution.   
  
Regards,   
Prince   


Loader.
Up arrow icon