We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to use UrlAdaptor in Asp.Net Core Razor Page?

Platform: ASP.NET Core |
Control: Grid |
Published Date: September 18, 2018 |
Last Revised Date: September 18, 2018

This knowledge base document explains you how to perform CRUD operation in Grid using UrlaAdaptor within the ASP.NET Core Razor page.

 

Solution

 

In ASP.NET Core, we have support to bind dataSource and perform CRUD operation without using controller class. Kindly follow the below steps to perform CRUD operation in Grid within the Razor page.  

 

  1. Create the ASP.NET Core application with razor using below help documentations

 

  1. https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/razor-pages-start?view=aspnetcore-2.1 
  2. https://help.syncfusion.com/aspnet-core/gettingstarted/getting-started-2-x

 

  1. Render the Grid inside the cshtml page

 

Since this razor page does not have specific controller page. Grid Datasource and CRUD actions mapping urls can be set by using the @page “{handler?}” in razor page. Refer the below code example. 

 

 

  1. In the load event of ejGrid, we suggest you to pass the antiforgery token along with the datamanager headers to retrieve data from the model class and bind it to grid.

 

 

 

C# [ModelPage]

 

  1. To update a record

 

  1. To insert a record

 

  1. To delete a record

 

Refer the below screenshot as the output of above code example

 

 

    

2X faster development

The ultimate ASP.NET Core UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment
Comments
Michael Lambert
Sep 24, 2018

Is there any difference in using EJ2 Grid?  Since there is no DataManger, would you just use DataManagerRequest DM in the code behind?

Reply

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon