Cascading Dropdown enabled when Parent not Selected

2 posts, 0 answers
  1. Chris
    Chris avatar
    20 posts
    Member since:
    Nov 2013

    Posted 29 Sep 2014 Link to this post

    Hi,

    I'm trying to create a cascading drop down list where the child (Order) is still enabled when the parent (Customer) has not been selected, as non selection means All Customers. i.e. the parent is the filter, so when its set to a particular value, the child shows the Orders that belong to that Customer, but when its not selected, the child should show all Orders.

    I have tried setting AutoBind to true, but that doesn't seem to help.

    Is this possible?

    Thanks,

    Chris

    @(Html.Kendo().DropDownList()
        .Name("Order")
        .DataTextField("Text")
        .DataValueField("Value")
        .DataSource(source =>
        {
            source.Read(read =>
            {
                read.Action("OrderList", "List")
                    .Data("filterOrders");
            })
            .ServerFiltering(true);
        })
        .OptionLabel("Please Select")
        .AutoBind(true)
        .CascadeFrom("Customer")
        .Enable(true)

    Script
    function filterOrders() {
        return {
            customerID: $("#Customer").val()
        };
    }

  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 01 Oct 2014 Link to this post

    Hello Chris,

    In general, the cascading functionality of the ComboBox, like the DropDownList, is designed to disable child widgets if parent hasn't any value. More information about the cascading feature can be found here. The described behavior cannot be changed and in order to accomplish your goal a custom implementation will be required. Here is a Dojo demo, that shows how to use change events of the widgets to perform data source filtration and disable/enable child widgets. You can use this approach as a starting point to implement your specific business logic.

    Regards,
    Georgi Krustev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top