How to not fire OnServerEditRow event when value is not changed

Hi there,

I'm using ejGrid control on ASP.NET Web Froms.

When I do double click the cell to modify value and then without changing, normally no event fired like  SQLBinding which is a sample code you provide.

But my grid fire OnServerEditRow event after editor mode exit without changing value in the cell. 

Is there any option or something for that?



Thanks in advance.

Yong






5 Replies

FS Farveen Sulthana Thameeztheen Basha Syncfusion Team March 11, 2022 04:26 PM UTC


Hi Yong Ho, 

We have checked your reported problem by preparing sample but we are unable to replicate the problem at our end(OnServerEditRow doesn’t trigger on cancelling the Edited values). Refer to the sample link:- 

We need some more additional details to find the cause of the issue. Share us the following details. 

  1. Complete Grid code example.
  2. Video demo to replicate the issue.
  3. Have you faced this on any specific scenario or enabling specific properties? If yes please share details.
  4. If possible replicate it in the above sample and revert us back or any hosted link to replicate the issue.
  5. Product version details.

Regards, 
Farveen sulthana T 



YH Yong Ho (Jake) March 14, 2022 01:28 AM UTC

Hi  Farveen,


Please see the attached videos and compare sample code and my code.

Sample one does not fire event when value is not changed but my code fire event even value is not changed.

What did I miss it?



 public partial class _Default : Page

    {

        private List<Orders> order = new List<Orders>();

        protected void Page_Load(object sender, EventArgs e)

        {

            BindDataSource();

        }

        private void BindDataSource()

        {

            int orderId = 10643;

            int empId = 0;


            order.Add(new Orders(orderId + 1, "ALFKI", empId + 1, 4500000, "Alfreds Futterkiste ", "Germany"));

            order.Add(new Orders(orderId + 2, "ANATR", empId + 2, 5500000, "Ana Trujillo Emparedados y helados", "Mexico"));

            order.Add(new Orders(orderId + 3, "ANTON", empId + 3, 6500000, "Antonio Moreno Taquería", "Mexico"));

            order.Add(new Orders(orderId + 4, "AROUT", empId + 4, 7500000, "Around the Horn", "UK"));

            order.Add(new Orders(orderId + 5, "BERGS", empId + 5, 8500000, "Berglunds snabbköp", "Sweden"));

            order.Add(new Orders(orderId + 6, "BLONP", empId + 6, 9500000, "Blondel père et fils", "France"));



            this.OrdersGrid.DataSource = order;

            this.OrdersGrid.DataBind();

        }


        [Serializable]

        public class Orders

        {

            public Orders()

            {


            }

            public Orders(int orderId, string customerId, int empId, double freight, string shipName, string shipCountry)

            {

                this.OrderID = orderId;

                this.CustomerID = customerId;

                this.EmployeeID = empId;

                this.Freight = freight;

                this.ShipName = shipName;

                this.ShipCountry = shipCountry;

            }

            public int OrderID { get; set; }

            public string CustomerID { get; set; }

            public int EmployeeID { get; set; }

            public double Freight { get; set; }

            public string ShipName { get; set; }

            public string ShipCountry { get; set; }

        }


        protected void EditEvents_ServerEditRow(object sender, GridEventArgs e)

        {

            EditAction(e.EventType, e.Arguments["data"]);

        }


        protected void EditEvents_ServerAddRow(object sender, GridEventArgs e)

        {

            EditAction(e.EventType, e.Arguments["data"]);

        }


        protected void EditEvents_ServerDeleteRow(object sender, GridEventArgs e)

        {

            EditAction(e.EventType, e.Arguments["data"]);

        }


        protected void EditAction(string eventType, object record)

        {

            if (eventType == "endEdit")

            {


            }


            else if (eventType == "endAdd")

            {


            }

            else if (eventType == "endDelete")

            {


            }


        }



<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="test._Default" %>



<html>

<head runat="server">

    <meta charset="utf-8" />

    <title></title>

    <link rel='nofollow' href="Content/ej/web/default-theme/ej.web.all.min.css" rel="stylesheet" />

    <script src="Scripts/jquery-1.10.2.min.js"></script>

    <script src="Scripts/jquery.easing.1.3.min.js"></script>

    <script src="Scripts/jquery.globalize.min.js"></script>

    <script src="Scripts/jsrender.min.js"></script>

    <script src="Scripts/ej.web.all.min.js"></script>

    <script src="Scripts/ej.webform.min.js"></script>

</head>

<body>

   <form runat="server">

     <asp:ScriptManager runat="server"></asp:ScriptManager>

     <asp:UpdatePanel ID="UpdatePanel1" runat="server">

        <ContentTemplate>

          <ej:Grid ID="OrdersGrid" runat="server" AllowPaging="True"

              AllowSorting="True" OnServerEditRow="EditEvents_ServerEditRow"

              OnServerAddRow="EditEvents_ServerAddRow" OnServerDeleteRow="EditEvents_ServerDeleteRow">

              <ClientSideEvents ActionComplete="complete" EndAdd="endAdd" EndDelete="endDelete" EndEdit="endEdit" ActionBegin="begin"

                  RecordDoubleClick="doubleClick" />

              <Columns>

                  <ej:Column Field="OrderID" HeaderText="Order ID" IsPrimaryKey="true" TextAlign="Right" Width="90" />

                  <ej:Column Field="CustomerID" HeaderText="Customer ID" Width="100" />

                  <ej:Column Field="EmployeeID" HeaderText="Employee ID" TextAlign="Right" Width="110" />

                  <ej:Column Field="Freight" HeaderText="Freight" TextAlign="Right" Width="90" Format="{0:N2}" />

                  <ej:Column Field="ShipCountry" HeaderText="Ship Country" Width="100" />

              </Columns>

              <EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True"></EditSettings>

              <ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings>

          </ej:Grid>

        </ContentTemplate>

     </asp:UpdatePanel>

   </form>

</body>

</html>




Attachment: video_55bd06c6.zip


FS Farveen Sulthana Thameeztheen Basha Syncfusion Team March 14, 2022 04:00 PM UTC

Hi Yong Ho, 

Thanks for your provided details. 

Query#:- Sample one does not fire event when value is not changed but my code fire event even value is not changed. 

From your provided video Demo, we found that you have pressed Enter without any changes in the value. In that scenario  OnServerEditRow triggersWe are able to replicate the problem in the above mentioned  scenario from our older versions(i.e. below 15.1.XX versions). So we suspect that you have referred older version in your project. 
 
To resolve the problem we suggest to upgrade into our latest version(19.4.0.48) or minimum of 15.2.X.XX version 

If you would like to upgrade to the latest version, please follow the below steps. 
              
            1)   Download and install the Essential Studio v19.4.0.48 from the below link.  
 
           2)  After upgrading to the latest version, you can get the Scripts and CSS from the below build location:- 


                You can get the script file from your build installed location and refer to the below location.  
              {programfilesfolder}\Syncfusion\Essential Studio\{Version}\JavaScript\assets \external \  
 
                Eg: C:\Program Files (x86)\Syncfusion\Essential Studio\19.4.0.48\JavaScript\assets\external\  

        3)    Otherwise you can also refer the cdn link reference for Scripts and CSS or else you can refer the links provided in the sample:- 
 
And also after upgrading please ensure to clear the browser cache to avoid accidental reference of the old scripts/CSS .Please get back to us if you need any further assistance. If the above solution doesn’t meet your requirement, share details(product version) to proceed further. 

Regards, 
Farveen sulthana T 





YH Yong Ho (Jake) replied to Farveen Sulthana Thameeztheen Basha March 15, 2022 01:16 AM UTC

Hi Farveen,

You're right. I was using a old version and all good now after upgrading a latest version.

Thank you for your help.


Regards,

Yong




FS Farveen Sulthana Thameeztheen Basha Syncfusion Team March 15, 2022 11:04 AM UTC

Hi Yong Ho, 

We are glad to know that your reported problem has been resolved. Please get back to us if you need any further assistance. We are happy to assist you. 

Regards, 
Farveen sulthana T 


Loader.
Up arrow icon