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

KeyVal receives NULL on "endDelete"

Hello Friends,
The following code returns NULL when  DeleteRow  "endDelete" event is trigered:

Thank you for your help and time,

Regards,

Rafael M.



protected void ejGrdAD2_DeleteRow(object sender, GridEventArgs e)
{
     EditAction2(e.EventType, e.Arguments["data"]);
}

protected void EditAction2(string eventType, object record)
{
     List<DAP> data = Session["DS2"] as List<DAP>;


     Dictionary<string, object> KeyVal = record as Dictionary<string, object>;  // here's the problem ...
     // record has the values like in a second level and assigns to KeyVal only the first level that is empty
     // only occurs when eventType is "endDelete" (see the attached image)


     if (eventType == "endEdit") {    //// endEdit Works OK ...
          DAP value = new DAP();
          foreach (KeyValuePair<string, object> keyval in KeyVal) {

          ... }

     else if (eventType == "endAdd"){     //// endAdd Works OK ...
          ...      }

     else if (eventType == "endDelete"){    //// ERROR in next line ... KeyVal is null ...
          foreach (KeyValuePair<string, object> keyval in KeyVal) {
               if (keyval.Key == "nKeyField1"){
                   DAP value = data.Where(d => d.nKeyField1 == (int)keyval.Value).FirstOrDefault();
                   data.Remove(value);

               }

          }

     }

     Session["DS2"] = data;
     this.ejGrdAD2.DataSource = data;
     this.ejGrdAD2.DataBind();
     bindDAP1();
     bindForeignKeys();
}


Attachment: syncfusion_grid_20170424_155159_92de5cfd.zip

1 Reply

SA Saravanan Arunachalam Syncfusion Team April 25, 2017 05:28 AM UTC

Hi Rafael, 
Thanks for contacting Syncfusion’s support. 
We are sorry that we are unable to reproduce the reported issue at our end and we have created a sample for your requirement that can be downloaded from the below link. 
If the issue is still exist, could you please provide the following details. 
1.       Share your view code. 
2.       Share the currently used build version. 
3.       If possible, please reproduce the issue in above attached sample. 
Regards, 
Saravanan A.  


Loader.
Up arrow icon