- Home
- Forum
- ASP.NET Core - EJ 2
- Crud ej2 grid using EF and SQL database and Remote Save Adapter
Crud ej2 grid using EF and SQL database and Remote Save Adapter
Hi Guys,
I have been trying to create a Grid with crud using EJ2 framework and core 3.1 using Entity Framework Code First ánd Remote Save Adapter , connecting to Microsoft SQL database I am not having any luck when trying to insert new record grid is not updating, do you have example code to above.
Regards
Edmund Herbert
Hi is anybody in support looking into this
SIGN IN To post a reply.
10 Replies
1 reply marked as answer
AG
Ajith Govarthan
Syncfusion Team
October 7, 2020 02:23 PM UTC
Hi Edmund,
Thanks for the update.
Based on your requirement you want to insert new record and update in them using the remoteSaveAdaptor based on that we suspect that your are using the normal edit mode in your grid application and we have shared the code example and documentation to insert the record at the server side. So please refer the code example and documentation for your reference.
For Insert operation :
|
HomeController.cs
public async Task<ActionResult> Insert([FromBody]CRUDModel<Orders> param)
{
_context.Orders.Add(param.Value);
await _context.SaveChangesAsync();
return Json(param.Value);
} |
For Update operation :
|
HomeController.cs
public async Task<ActionResult> Update([FromBody]CRUDModel<Orders> param)
{
_context.Orders.Update(param.Value);
await _context.SaveChangesAsync();
return Json(param.Value);
} |
For Delete operation :
|
HomeController.cs
public async Task<ActionResult> Delete([FromBody]CRUDModel<Orders> param)
{
Orders value = _context.Orders.Where(e => e.OrderID == Int32.Parse(param.Key.ToString())).FirstOrDefault();
_context.Remove(value);
await _context.SaveChangesAsync();
return Json(value);
} |
|
Index.cshtml
<ejs-grid id="Grid" allowPaging="true" height="300" toolbar="@(new List<string>() {"Add", "Edit", "Update", "Delete" })">
<e-data-manager json ="@ViewBag.dataSource" adaptor="RemoteSaveAdaptor" insertUrl="/Home/Insert" updateUrl="/Home/Update" removeUrl="/Home/Delete" ></e-data-manager> <e-grid-columns>
…
</e-grid-columns>
</ejs-grid> |
UG-Links:
if you still face the issue then please share the below details to validate further on your requirement.
- Share the complete grid rendering code example and the server side codes.
- Share the screenshot or video demonstration of the issue.
- Share the Syncfusion package version
Regards,
Ajith G.
Marked as answer
EH
Edmund Herbert
October 8, 2020 07:43 AM UTC
Thanks Guys
Just what I needed
AG
Ajith Govarthan
Syncfusion Team
October 9, 2020 12:59 PM UTC
Hi Edmund,
Thanks for your update.
We are happy to hear that your issue has been resolved.
Please get back to us if you need further assistance.
Regards,
Ajith G.
EH
Edmund Herbert
October 9, 2020 01:58 PM UTC
Hi
I implemented data grid as per your example, i also tried your core console and created Grid app, on both apps when you insert record value to be inserted is null
what am i doing wrong here
Please see attached image
Attachment: Screenshot_20201009_155449_c8825106.zip
EH
Edmund Herbert
October 9, 2020 02:34 PM UTC
Hi OK worked out insert record all fields must have values now I have issue that grid does not show inserted record please see attached image
i used workaround where i reloaded page but that is not how grid should wo
Attachment: Screenshot_20201009_162926_b17483dc.zip
EH
Edmund Herbert
October 11, 2020 10:04 AM UTC
Hi,
I have attached example project that has insert record issue
Regards
Edmund Herbert
Attachment: TeamsTechTrack_55989c83.zip
AT
Atli
October 11, 2020 12:27 PM UTC
Hello Edmond,

I have been following this thread because I am trying to achieve similar functionality with ASP-Net Core 3 and Entity Framework. Have you tried to add a new controller, selecting "New Scaffolded Item" and then select the "Syncfusion ASP.NET Core UI Scaffolder". This generated code for me that worked at least partially.
I also look forward to a more detailed reply from Syncfusion.
regards
Atli
AT
Atli
October 11, 2020 12:38 PM UTC
Hi again Edmund,

You also have to choose "Remote Data" as Data Source Type:
EH
Edmund Herbert
October 11, 2020 03:20 PM UTC
Hi,
I have resolved issue forgot isIdentity="true" in Id field all working now thank you for your support
Regards
Edmund Herbert
AG
Ajith Govarthan
Syncfusion Team
October 12, 2020 02:44 PM UTC
Hi Edmund,
Thanks for your update.
We are happy to hear that your issue has been resolved.
Please get back to us if you need further assistance.
Regards,
Ajith G.
SIGN IN To post a reply.
- 10 Replies
- 3 Participants
- Marked answer
-
EH Edmund Herbert
- Oct 3, 2020 02:17 PM UTC
- Oct 12, 2020 02:44 PM UTC