Is it possible to add new item dynamically?

2 posts, 0 answers
  1. George
    George avatar
    3 posts
    Member since:
    Jun 2018

    Posted 01 Nov 2018 Link to this post

    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?

     

     

  2. Tsvetomir
    Admin
    Tsvetomir avatar
    574 posts

    Posted 06 Nov 2018 Link to this post

    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.
Back to Top