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

Dispaly record in gridview on first position after save fails .

Waiting for your quick reply 
Its urgent 

Technology  : Must be angualr js and mvc

point 1  I do not want to allow edit functionality in Grid view
Point 2 after insert record in gridview click on save
Point 3 If I am getting error while save I want to display that newly added record again on first position of grid  and It should be display in textbox like before save. (means textbox should be open with old data)

5 Replies

AS Alan Sangeeth S Syncfusion Team August 21, 2015 10:07 AM UTC

Hi Bharath,

Thanks for using Syncfusion products.

Query 1: “Disable Editing”

We can disable editing in Grid using “allowediting” Grid property. Please refer the following code snippets.

<div id="grid" ej-grid e-datasource="data" e-actionfailure="failure" e-editsettings-allowediting='false' e-editsettings-allowadding='true'>

Query 2: “Need to display added record in Edit Form after error on save”

We suspect that you need to validate record details in the server-side. By default, if error or exceptions occurred in server-side during save operation, then added record would not be saved in Grid and it remain still showing EditForm in Grid row.

We can validate the added record and show the error occurred in server-side using “actionfailure” Grid event. Please refer the following code snippets.

<div id="grid" ej-grid e-datasource="data" e-actionfailure="failure"  e-allowpaging="true" >

$scope.failure = function (args) {

                  this.model.isEdit = true



public ActionResult Insert(Supplier value)


            if (!ModelState.IsValid)


                var message = string.Join(" | ", ModelState.Values

       .SelectMany(v => v.Errors)

       .Select(e => e.ErrorMessage));

                return new HttpStatusCodeResult(HttpStatusCode.BadRequest, message);



For your convenience we have created a sample and the same can be downloaded from below link.

Sample:  http://www.syncfusion.com/downloads/support/forum/119985/ze/CRUDandValidation-22652058

In the above sample, if we enter invalid value for Email field it will be validated in server-side and shows error message in view.

Please let us know if you need any further assistance.

Alan Sangeeth S

BB Bharat Buddhadev August 22, 2015 09:44 AM UTC

Happy to hear from you but i have some problem with this code.

I am using webapi to insert record in database. so when i call webapi from javascript(AngularJS) i got error in catch part. see below code snippet for better understanding.

$scope.actioncomplete = function (args) {
            if (args.requestType === $scope.action) {
                $scope.cmisIsValid = true;
               //Api call for save record                
                    .then(function (result) {
                        $scope.cmisIsValid = true;
                    .catch(function (error) {
                        $scope.cmisIsValid = false;                  

$scope.failure = function (args) {
            args.model.isEdit = true

RU Ragavee U S Syncfusion Team August 24, 2015 11:41 AM UTC

Hi Bharat,

We have analyzed the reported issue and we need few details from your end in order to assist you effectively.

1.       Could you please let us know the usage of saveUserSettings() method in your sample project?
2.       If possible, please share the code snippet corresponding to the saveUserSettings() function
3.       Could you please share the stack trace of the exception/error obtained in the catch part.

For your convenience, we have modified our sample to use Webapi service and the same can be downloaded from the below location.

Sample Link: http://www.syncfusion.com/downloads/support/forum/119985/ze/Sample-124030196

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

Ragavee U S

BB Bharat Buddhadev September 3, 2015 01:12 PM UTC


I am sharing you little bit of code as per your request.

        public UserSettings Post(DatabaseServer serverToAdd)
            return AddDBServerSetting(serverToAdd);
public UserSettings AddDBServerSetting(DatabaseServer serverToAdd)
            if (serverToAdd == null)
                throw new ArgumentNullException("serverToAdd");

            _settings = RetrieveUserSettings();
            DatabaseOverview databaseOverview = CheckPdbVersion(serverToAdd);
            serverToAdd.PdbName = databaseOverview.DatabaseName;

            return _settings;

and i also sharing you stack trace with you.

i see your attached code but i can't find any useful solution related to this issue.

Kind regards,

Attachment: stacktrace_79cfa3d8.7z

RU Ragavee U S Syncfusion Team September 4, 2015 07:33 AM UTC

Hi Bharat,

In the provided screenshot, we found that the server returned a general 403 forbidden exception. The POST request is not triggered from Grid Control and it has been triggered manually.

Please refer to the following link for handling the 403 forbidden issue,


Since we are quite unclear about the requirement, please provide clear details on triggering a POST in actionComplete event of the Grid.

Ragavee U S

Live Chat Icon For mobile
Up arrow icon