Databinding and CRUD operations

Hello,

  I am new to Syncfusion and I have been working with the ASP.NET MVC Scheduler. I have read through the documentation and I seem to be missing something because I don't get any appointments on my Calendar when using a UrlAdaptor as described on these pages: https://ej2.syncfusion.com/aspnetcore/documentation/schedule/data-binding and https://ej2.syncfusion.com/aspnetcore/documentation/schedule/crud-actions

  I can use my controller to get data from my SQL Server and put it into an AppointmentData class. If I simply pass it as a List<AppointmentData> the Schedule is populated and works well. However, this won't let me make changes in the Schedule and pass them back to the database.

  The next step was to create a DataAdaptor on my chtml page as described on the Data Binding help topic. I added a GetData method that creates a List<AppointmentData> then returns it as a JSON result as described. I can see that 20 appointments are in the list but none show up on the Schedule.

  As to the CRUD operations I created UpdateData in the controller which does get called when clicking the Save button on the Edit popover. However, the params object is only populated with the action of "UpdateData". The code describes setting up actions for Insert, Update and Delete.

  Just need a bit more code to understand how to get the appointments to display from the GetData call and how to populate the params object when data is changed.

As a quick side note the GetData method gets called frequently (i.e. when the Schedule is scrolled or the view is changed) with a lot of appointments this could affect performance. Seems like sending a StartDate and EndDate to GetData would allow for filtering of the data which would be much more efficient.

Hopefully I'm just missing something simple.


3 Replies

SR Swathi Ravi Syncfusion Team November 27, 2023 11:34 AM UTC

Hi Chris,


By referring to the UG (User Guide) links provided below, you can learn how to handle CRUD operations in the Scheduler:


URL Adaptor: https://ej2.syncfusion.com/aspnetmvc/documentation/schedule/data-binding#scheduler-crud-actions

Scheduler CRUD actions: https://ej2.syncfusion.com/aspnetmvc/documentation/schedule/crud-actions


Also, you can access the Scheduler URL Adaptor sample from the following repository.


https://github.com/SyncfusionExamples/ej2-aspmvc-scheduler-crud



Regards,

Swathi Ravi 



CF Chris Franz November 27, 2023 07:36 PM UTC

Swathi,


  Thank you for the great example I was able to run your sample successfully.  

  However, I realized that my project is ASP.NET CORE v7 not an ASP.NET MVC application and they seem to behave differently. Using the same code you provided in my existing ASP.NET CORE application does not work. I am not getting results back and the parameters you specified are not being populated correctly.

  Is this possible in ASP.NET CORE or should I change to an ASP.NET MVC style application instead? 

Chris



SR Swathi Ravi Syncfusion Team November 28, 2023 12:26 PM UTC

Chris,

You can get the working sample of URL adaptor in ASP.NET Core from the following link. https://github.com/SyncfusionExamples/aspnetcore-scheduler-crud-actions-with-editor-template Get back to us if you need any further assistance. 


Loader.
Up arrow icon