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

DropDown cascading doesn't work with UrlAdaptor

Hi,

I bind dropdownlist with Url adaptor, but cascading doesn't work. If I bind with viewbag, it works.

I attach an example

Attachment: DropDownExample_5558f77b.zip

3 Replies

KV Karthikeyan Viswanathan Syncfusion Team March 28, 2017 10:47 AM UTC

Hi Manolo,   
     
Thanks for contacting Syncfusion support.      
  
In URL databinding, data request will be raised to server based on the query it will return the data but, assigned viewbag data is a local data. Local data query processed internally and it will be shown in the data for corresponding item. In URL databinding, you should execute the query based on the parent dropdown list selection.   
 
Please refer to the code snippet:  
<code>  
@Html.EJ().DropDownList("groupsList2").Datasource(ds => ds.URL(@Url.Content("~") +"Dropdownlist/GetGroupsJson").Adaptor(AdaptorType.UrlAdaptor)).DropDownListFields(f => f.Value("parentId").Text("text")).CascadeTo("countryList2").EnableRTL(false).ClientSideEvents(obj => obj.Cascade("dropcascade"))  
</code>  
<code>  
<script type="text/javascript">  
    function dropcascade(args) {  
        args.cascadeQuery = ej.Query().where(args.model.fields.value, "==", args.cascadeValue);  
}  
</script>  
</code>  
<code>  
        public JsonResult GetCountriesJson(Syncfusion.JavaScript.DataManager dm)  
        {  
            Syncfusion.JavaScript.DataSources.DataOperations operation = newSyncfusion.JavaScript.DataSources.DataOperations();  
            return Json(operation.Execute(GetCountries(), dm));  
        }  
</code>  
           
         
Regards,          
Karthikeyan V. 



MA Manolo March 31, 2017 11:08 AM UTC

Thanks!


KV Karthikeyan Viswanathan Syncfusion Team April 3, 2017 04:37 AM UTC

Hi Manolo,    
 
Thanks for the update.  
 
We are glad the suggestion helped you to achieve your requirement.  
 
Please let us know if you need further assistance.  
 
Regards,   
Karthikeyan V. 


Loader.
Live Chat Icon For mobile
Up arrow icon