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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Example of CRUD operations with SQL server in ASP.NET Core Razor environment

Thread ID:





146787 Aug 20,2019 08:39 AM UTC Dec 4,2019 06:19 AM UTC ASP.NET Core - EJ 2 4
Tags: DataGrid
Albert Morgades
Asked On August 20, 2019 08:39 AM UTC

I am using a dataGrid component in a ASP.NET Core Razor project to interact with a SQL database but cannot get the CRUD operations to work.
The routine defined in the removeURL property does not seem to be called at all.
Can you please tell me what is wrong with the code below? Thank you.


<ejs-grid id="GridPaikat"
          toolbar="@(new List<string>() {"Add", "Edit", "Update", "Delete", "Search", "Cancel" })">
    <e-data-manager json="@Model.Havaintopaikka.ToArray()"
    <e-grid-editSettings allowDeleting="true"></e-grid-editSettings>
        <e-grid-column field="Id" headerText="Id" width="50" isPrimaryKey="true"></e-grid-column>
        <e-grid-column field="Alue" headerText="Alue"></e-grid-column>
        <e-grid-column field="Lyhenne" headerText="Lyhenne"></e-grid-column>
        <e-grid-column field="Paikka" headerText="Paikka"></e-grid-column>

    function onLoad() {
        this.dataSource.dataSource.headers = [{ 'XSRF-TOKEN': $("input:hidden[name='__RequestVerificationToken']").val() }];

        public JsonResult OnPostRemove([FromBody]CRUDModel<Havaintopaikka> value)
            return new JsonResult(value);

Kevin Swanner
Replied On August 20, 2019 07:35 PM UTC

I have the same situation. I am trying to edit a DataTable retrieved from SQL Server using a DataGrid (any edit mode, but mostly either inline or form). I can get the data relatively simply. But after I edit, the routine called is wanting an IEnumerable and that's as far as I get. It would be nice to have a good example of how to do this, as the documentation doesn't go into much detail or explanation.

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On August 21, 2019 10:42 AM UTC

Hi Customers,  
We have prepared a sample with the CRUD Action in the Razor Page that can be downloaded from the following location.  
Seeni Sakthi Kumar S. 

Rui Mendes
Replied On December 3, 2019 08:35 AM UTC


Disclaimer: new user here
Using the provided example https://www.syncfusion.com/downloads/support/forum/146787/ze/EJ2Grid334825853.zip  (which works well up-front) and updating to the newest EJ2.Asp:Net.Core versions 17.3.x breaks the solution with a "Uncaught SyntaxError: Unexpected token 'var'" error
  "dataSource": var DataManager=new ejs.data.DataManager({
  "adaptor": new ejs.data.RemoteSaveAdaptor(),
  "removeUrl": "/Index?handler=Remove",
  "json": ejs.data.DataUtil.parse.isJson([

I'm using EJ2 community license and am getting the same error: basically in my testings I find the Grid works well (e.g. fed from a list) until I start to adopt  <e-data-manager> tag (for CRUD implementation).

Any hints on what could be the cause?

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On December 4, 2019 06:19 AM UTC

Hi Rui, 
Query: newest EJ2.Asp:Net.Core versions 17.3.x breaks the solution with a "Uncaught SyntaxError: Unexpected token 'var'" error 
We can reproduce the reported problem and we have already fixed the reported problem at our end. You can resolve the reported problem by upgrading NuGet version to For your reference, we have attached the sample with NuGet version 
Please get back to us if you need further assistance. 
Seeni Sakthi Kumar S 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

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

Live Chat Icon For mobile
Live Chat Icon