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

Is it possible to add new item dynamically?

1 Answer 274 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
George
Top achievements
Rank 1
George asked on 01 Nov 2018, 07:24 PM

I'm trying to use the MultiSelect widget to show tags on an object and allow the users to add new ones dynamically that will get created as they add them (and linked to the object upon save of the page). I'm basing the work on the following example:

    https://demos.telerik.com/kendo-ui/multiselect/addnewitem

However, I'm trying to do this with the ASP.NET Core widget, and I'm running into problems when trying to set up the datasource. It appears I can only add a Read method and cannot add a Create similar to the above linked example. 

Is this not supported in the ASP.NET Core version? Or is there a ASP.NET Core example somewhere on the site that I just can't find?

 

 

1 Answer, 1 is accepted

Sort by
0
Tsvetomir
Telerik team
answered on 06 Nov 2018, 02:44 PM
Hi George,

There is not a separate live demo for adding a new item for Kendo UI Core because mostly the logic is executed on the client. The approaches for the ASP.NET MVC and ASP.NET Core are similar. 

Regarding the Create Action method in the data source, it appears that declaring only Read Action method is allowed. What you can do is to instantiate the DataSource separately and set up the Create Action method there. 

I created a sample project to demonstrate how the aforementioned live demo could be implemented using Kendo UI for ASP.NET Core. What I have done differently:
  1. Declare the DataSource component outside the MultiSelect widget. 
  2. Attach the RequestEnd event to the widget.
  3. Set the NoDataTemplateId and paste the template in a separate script tag.
  4. Included a dummy data in the HomeController along with the Read and Create Action methods.

Should you need further clarifications, feel free to contact me. 


Kind regards,
Tsvetomir
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
MultiSelect
Asked by
George
Top achievements
Rank 1
Answers by
Tsvetomir
Telerik team
Share this question
or