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

Html.Kendo().DataSource for MultiSelect?

3 Answers 361 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
Robert Madrian
Top achievements
Rank 1
Veteran
Iron
Robert Madrian asked on 07 Dec 2017, 02:29 PM

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

3 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 12 Dec 2017, 09:38 AM
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.
0
Robert Madrian
Top achievements
Rank 1
Veteran
Iron
answered on 12 Dec 2017, 09:59 AM

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

0
Dimitar
Telerik team
answered on 13 Dec 2017, 03:43 PM
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.
Tags
MultiSelect
Asked by
Robert Madrian
Top achievements
Rank 1
Veteran
Iron
Answers by
Dimitar
Telerik team
Robert Madrian
Top achievements
Rank 1
Veteran
Iron
Share this question
or