Razor MVC Remote Datasource with filtering

2 posts, 0 answers
  1. Shane
    Shane avatar
    2 posts
    Member since:
    Mar 2014

    Posted 26 Feb 2015 Link to this post


    I'm using the Razor HtmlHelper for the ComboBox populating the items on-demand and filtered much like your cascading combobox demo (http://demos.telerik.com/aspnet-mvc/combobox/cascadingcombobox). However my combobox needs to pass multiple filters to the server in a specific JSON object (filters must form part of an array) and data is returned in a JSON object. In summary I really need to have complete control of the request and response handling and would like to know the approach you'd recommend. Would a custom datasource be best with a parameterMap? I've not seen a real in-depth demo of how this is done with the Razor HtmlHelpers.

    Lastly the server filtering I'm using adds in the filters currently like the demo mentioned above whereby you specify a javascript function name to supply the additional filters e.g. Data("filterProducts");. However I'm finding this rather limiting as I have a large number of comboboxs and each one must have it's own method, they all do the same thing pretty much however they rely on custom data attributes on the combobox box itself. Is there a way to have the combobox object/selector passed into the function?

  2. Alexander Popov
    Alexander Popov avatar
    1436 posts

    Posted 02 Mar 2015 Link to this post

    Hello Shane,

    Both using a custom DataSource with a parameterMap and using the Data method are suitable approaches. You can use a single function for all ComboBox widgets and pass their unique IDs using a proxy function. For example: 
    .Read(r=>r.Action("Read", "Controller").Data(@<text> additionalData("someID") </text>))
        function additionalData(id) {

    Alexander Popov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top