Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
330
Requested record cannot be found by key undoing grid changes
posted

 

I have a webdatatree control based on which the data for my webhierarchicaldatagrid is bound with.

Say I made some changes in the grid and without submitting the page I click on another node of the tree I need to confirm with the user for the unsaved changes and if the user opts to undo the changes, I get the following error.

 

Exception Type: Infragistics.Web.UI.GridControls.MissingRecordException

 

Message:

========

Requested record cannot be found by key.

 

Stack Trace:

============

   at Infragistics.Web.UI.GridControls.EditingCore.OnAction(String actionType, Object id, Object value, Object tag)

   at Infragistics.Web.UI.GridControls.GridBehavior.Infragistics.Web.UI.GridControls.IGridBehavior.OnAction(String actionType, Object id, Object value, Object tag)

   at Infragistics.Web.UI.GridControls.GridBot.LoadAdditionalClientState(Object state)

   at Infragistics.Web.UI.GridControls.ContainerGridBot.LoadAdditionalClientState(Object state)

   at Infragistics.Web.UI.Framework.RunBot.HandleRaisePostDataChangedEvent()

   at Infragistics.Web.UI.GridControls.GridBot.HandleRaisePostDataChangedEvent()

   at Infragistics.Web.UI.GridControls.ContainerGrid.RaisePostDataChangedEvent()

   at System.Web.UI.Page.RaiseChangedEvents()

   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)InnerException 1

 

 

My code

 

 

 Sys.Application.add_init(application_init);
 function application_init() {
var prm = Sys.WebForms.PageRequestManager.getInstance();
            prm.add_initializeRequest(prm_initializeRequest);}

 

 

function prm_initializeRequest(sender, args) {
            try {
 
                //var tree = $find("<%= wdtTree.ClientID %>");
                var grid = $find("<%= whdgGrid.ClientID %>");
                var hasChanges = false;
                if (grid != null) {
                    if (grid.get_gridView()._actionList._count > 0) {
                        hasChanges = true;
                    }
                }
 
                if (sender._postBackSettings.sourceElement.id == "<%= wdtTree.ClientID %>" && hasChanges==true)
                 {
                     grid.get_gridView().get_behaviors().get_editingCore().clearBatchUpdates();
                     //grid.get_gridView()._actionList.clear();
                 }
 
                else if (sender._postBackSettings.sourceElement.id != '<%= btnSubmit.ClientID %>' && hasChanges ==true) 
                {                                                        
                            var submitChanges = confirm("Well allocation data has been modified do you want to review and save the changes?");
                            if (!submitChanges)
                              grid.get_gridView().get_behaviors().get_editingCore().clearBatchUpdates();
                            else {                            
                                alert("Please click on submit button to save changes.");                                                                                               
                                args.set_cancel(true);
                            }                        
                    }                   
 
            } catch (e) {}           
        }

 

 

thanks

 

 

Parents
No Data
Reply Children