This is a migrated thread and some comments may be shown as answers.

DropDownList cascadeFrom a Autocomplete control

1 Answer 37 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Adem
Top achievements
Rank 1
Adem asked on 29 Feb 2016, 12:13 PM
Can I give  a AutoComplete object to a dropdownlist's CascadeFrom parameter? I have tried it  but it didn't work.(two dropdownlist worked fine)


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>

1 Answer, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 02 Mar 2016, 08:49 AM
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
 
Tags
AutoComplete
Asked by
Adem
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Share this question
or