DropDownList cascadeFrom a Autocomplete control

2 posts, 0 answers
  1. Adem
    Adem avatar
    13 posts
    Member since:
    Feb 2016

    Posted 29 Feb Link to this post

    Can I give a dropdownlist's CascadeFrom parameter a AutoComplete? I have tried it  but it didn't work.

     

    public JsonResult GetCustomers()
            {
                return Json(CustomerRepository.Repository.Customers, JsonRequestBehavior.AllowGet);
            }
     
            public JsonResult GetVendors(int customerId,int customerId2)
            {
                return Json(VendorRepository.Repository.GetVendorsByCustomer(customerId), JsonRequestBehavior.AllowGet);
            }

    function filterVendors() {
        return {
            customerId: $("#CustomerId").data("kendoAutoComplete").value(),
            customerId2: $("#CustomerId").data("kendoAutoComplete").value(),
     
        };
    }
     
    function filterProducts() {
        return {
            vendorId: $("#VendorId").data("kendoDropDownList").value()
        };
    }

    <dl>
        <dt>
            @Html.LabelFor(m => m.CustomerId):
        </dt>
        <dd>
             
            @(Html.Kendo().AutoCompleteFor(m => m.CustomerId).Name("CustomerId")
                  .ValuePrimitive(true)
                          .DataTextField("CustomerId")
                  .DataSource(dataSource =>
                  {
                      dataSource.Read(read => read.Action("GetCustomers", "Home"))
                                .ServerFiltering(true);
                  })
            )
            @Html.ValidationMessageFor(m => m.CustomerId)
        </dd>
    </dl>
    <dl>
        <dt>
            @Html.LabelFor(m => m.VendorId):
        </dt>
        <dd>
            @(Html.Kendo().DropDownListFor(m => m.VendorId)
                  .AutoBind(false)
                  .ValuePrimitive(true)
                  .OptionLabel("Select Vendor...")
                  .DataTextField("VendorName")
                  .DataValueField("VendorId")
                  .DataSource(dataSource =>
                  {
                      dataSource.Read(read => read.Action("GetVendors", "Home").Data("filterVendors"))
                                .ServerFiltering(true);
                  })
                  .CascadeFrom("CustomerId")
            )
            @Html.ValidationMessageFor(m => m.VendorId)
        </dd>
    </dl>

  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 02 Mar Link to this post

    Hello Jale,

    I am afraid that such functionality is not supported and if you need something like this, you need to use the widget events to manually implement the cascading functionality. Please check the following documentation articles that might be helpful:

    http://docs.telerik.com/kendo-ui/api/javascript/ui/autocomplete

    http://docs.telerik.com/kendo-ui/api/javascript/data/datasource

    Regards,
    Kiril Nikolov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top