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

Grid doesn't refresh after insert and update (using RemoteAdapter)

Thread ID:

Created:

Updated:

Platform:

Replies:

143012 Feb 28,2019 02:02 PM UTC Mar 6,2019 10:51 AM UTC ASP.NET Core - EJ 2 3
loading
Tags: DataGrid
Elena Popova
Asked On February 28, 2019 02:02 PM UTC

I successfully insert and update entities using the RemoteAdapter functions insert and update, but my grid is not refreshing after that, i have to press f5 to refresh the grid.
My functions are in HomeController and the Grid is in the index view.

  public ActionResult Update([FromBody]CRUDModel<Customer> value)
        {
            var customer = value.value;
            dbContext.Customers.Update(customer);
            dbContext.SaveChanges();

            var customers = dbContext.Customers.ToList();

            return Json(value);

        }
        public ActionResult Insert([FromBody]CRUDModel<Customer> value)
        {
            var cust = value.value;
            dbContext.Customers.Add(cust);
            dbContext.SaveChanges();

            var customerLast = dbContext.Customers.Last();

            return Json(value);
        }



I also tried passing the updated entity after dbsave to the Json function and also the entire list but its not working.
I would be very happy if somebody can tell me why is not refreshing. I attached the whole project.
Thank you in advance!

Attachment: WebApplication2_1c915714.rar

Thavasianand Sankaranarayanan [Syncfusion]
Replied On March 1, 2019 09:28 AM UTC

Hi Elena, 

Greetings from the Syncfusion.  

We have analyzed your query provided sample and we have suspect that update/insert code format is not properly in the server end. In below code example, we have explained the required code format in update and insert methods in server end. You can achieve your requirement by using below way code example. Please refer below code example and sample for more information. 

[HomeController.cs] 
    public ActionResult Update([FromBody]CRUDModel<OrdersDetails> value) 
        { 
            var ord = value.value; 
            OrdersDetails val = OrdersDetails.GetAllRecords().Where(or => or.OrderID == ord.OrderID).FirstOrDefault(); 
            val.OrderID = ord.OrderID; 
            val.EmployeeID = ord.EmployeeID; 
            val.CustomerID = ord.CustomerID; 
            val.Freight = ord.Freight; 
            val.OrderDate = ord.OrderDate; 
            val.ShipCity = ord.ShipCity; 
 
            return Json(value.value);  // return a edited data alone 
        } 
        //insert the record 
        public ActionResult Insert([FromBody]CRUDModel<OrdersDetails> value) 
        { 
 
            OrdersDetails.GetAllRecords().Insert(0, value.value); 
            return Json(value.value); 
        } 


The below screenshot to know details about the update method returned value and browser is shown updated data in result. 

Screenshot: 
 

 

Please get back to us, if you need further assistance. 

Regards, 
Thavasianand S. 


Elena Popova
Replied On March 5, 2019 10:04 AM UTC

Hi Thavasianand Sankaranarayanan,

It turned out that the properties of my entity and the properties in the grid itself need to be in lower cases, otherwise it doesn't work. I suppose it is some kind of issue with the components working with core 2.2.

Regards,
Elena

Thavasianand Sankaranarayanan [Syncfusion]
Replied On March 6, 2019 10:51 AM UTC

Hi Elena, 

Thanks for your update. 

We have already discuss about the above mention query in the following documentation. 


Regards, 
Thavasianand S. 


CONFIRMATION

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

;