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

Problem with record ID in "endadd" client-side method

Thread ID:





128417 Jan 20,2017 01:01 AM UTC Jan 20,2017 10:17 AM UTC ASP.NET MVC 1
Tags: Grid
R Brian Lindahl
Asked On January 20, 2017 01:01 AM UTC

I have a grid where I'm trying to use the endadd method to redirect to a detail page after a record is added. I'm pretty sure it worked when I first implemented it a month or two ago. However, it doesn't work anymore. My event is:

function endadd(args)
      window.location = "/OrderItemsEdit?o=" + args.data.OrderID;

the related field/column is:


From what I can tell from reading the documentation, the IsIdentity(true) should result in an auto-incremented value. However, args.data.OrderID is zero, and results in an error in the target controller due to an invalid ID.

Should this work the way I'm understanding? If not, is there a way to achieve what I want? I was hoping that there was an event that would happen after the CRUD insert operation came back from the server, so it could get the actual ID that was auto-generated in the database, but I didn't see an event for that.

Venkatesh Ayothi Raman [Syncfusion]
Replied On January 20, 2017 10:17 AM UTC

Hi Brian, 

Thanks for contacting Syncfusion support. 

As from your query,If we enable the Isidentity property for Auto increment column then we must handle Auto increment column. Example if we bound the remote data source for the Grid, then we will to return the Isdentity column while adding the record. 
So, we are the responsibility to handle the Isidentity property. While performing CRUD operation in Grid with IsIdentity column, we need to return the modified value, because of we have handled IsPrimary key column value in server side. So, we suggest you to return the modified value while performing the CRUD operation in Grid like as follows, 
Code example
public ActionResult Insert(OrdersView value) 
            value.OrderID = ++count; //Auto increment the value for isIdnetity property 
            return Json(value, JsonRequestBehavior.AllowGet); 

Venkatesh Ayothiraman. 


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