Html.Kendo().DataSource for MultiSelect?

4 posts, 0 answers
  1. Robert Madrian
    Robert Madrian avatar
    223 posts
    Member since:
    Apr 2003

    Posted 07 Dec 2017 Link to this post

    Hello,

    I have multiple MultiSelectFor in my view with the same Ajax Datasource - now I want to use the Html.Kendo().DataSource for all of this

    MultiSelectFor but it seems this is not possible - is it only possible to use Html.Kendo().DataSource with Grid and Autocomplete like in the sample?

    how to share a datasource with multiple MultiSelectFor or FropDownFor?

    (I don't want to have multiple requests)

    robert

  2. Dimitar
    Admin
    Dimitar avatar
    731 posts

    Posted 12 Dec 2017 Link to this post

    Hello Robert,

    I am attaching an ASP.NET MVC solution, where a similar scenario to the one described is demonstrated (Multiple Kendo UI Widgets with a shared DataSource).

    To achieve the desired result, the internal implementation for the SharedDataSource depends on the usage of DataSourceRequest and ToDataSourceResult extension methods in order to properly bind the widget data:
    public ActionResult GetProducts([DataSourceRequest] DataSourceRequest request)
    {
      var products = Enumerable.Range(0, 500).Select(i => new ProductViewModel
      {
        ProductID = i,
        ProductName = "Product " + i
      });
     
      return Json(products.ToDataSourceResult(request));
    }


    Regards,
    Dimitar
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Robert Madrian
    Robert Madrian avatar
    223 posts
    Member since:
    Apr 2003

    Posted 12 Dec 2017 in reply to Dimitar Link to this post

    Hello,

    You send me a MVC sample bit I use the CORE Version and it seems this is different because it doesn't work (see attached Picture)

    robert

  4. Dimitar
    Admin
    Dimitar avatar
    731 posts

    Posted 13 Dec 2017 Link to this post

    Hello Robert,

    I apologize for not sending an ASP.NET Core solution.

    The syntax required for a Core application is basically the same. However, I have investigated the scenario further by preparing an ASP.NET Core sample, and I have noticed that the MultiSelect widget is missing an overload method that allows the DataSource option for this widget to accept a string. Thus, the described error can be observed.

    I have logged a new enhancement issue with high priority in the official Kendo UI GitHub repository and you can start tracking the progress that we make on it from item #3849

    As a side note, you should be able to use a shared DataSource for other widgets like the AutoComplete and Grid, as shown in this ASP.NET Core Demo.

    Also, as a token of gratitude for helping us discover this issue, I have updated your Telerik Points accordingly.

    Regards,
    Dimitar
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top