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
325
WEB DAT GRID - BATCH UPDATE - MissingRecordException
posted
ENVIRONMENT:  VISUAL STUDIO 2008, VB.NET, ASP.NET Framework 3.5, NetAdvantage Select 2012 Vol. 1 I have 3 controls on the page… · Dropdown list · SqlDataSource · Webdatagrid (EnableDataViewState = false, EditingCore.AutoCRUD = true, EditingCore.BatchUpdating = true) -------------------------------------------------------------------------------------------------- Dropdownlist.selected value is the SelectParameter for the SqlDataSource Select Command. Everytime the user selects a new item in the dropdown list I postback to the server and call a method. In the method I perform a SqlDataSource.DataBind and a webdatagrid.DataBind. -------------------------------------------------------------------------------------------------- I can successfully do batch updates in the grid and then save the changes to the database. After saving the changes I can select a different item from the dropdown list and rebind the webdatagrid. -------------------------------------------------------------------------------------------------- The problem comes if I update the grid and do NOT save the changes before selecting a new item from the dropdownlist (triggering the SqlDataSource.DataBind and the webdatagrid.DataBind). When I have pending changes and I rebind the grid I get a MissingRecordException. Here’s the Stack trace… -------------------------------------------------------------------------------------------------- [MissingRecordException: Requested record cannot be found by key.]    Infragistics.Web.UI.GridControls.EditingCore.OnAction(String actionType, Object id, Object value, Object tag) +1030    Infragistics.Web.UI.GridControls.GridBehavior.Infragistics.Web.UI.GridControls.IGridBehavior.OnAction(String actionType, Object id, Object value, Object tag) +48    Infragistics.Web.UI.GridControls.GridBot.LoadAdditionalClientState(Object state) +1299    Infragistics.Web.UI.Framework.RunBot.HandleRaisePostDataChangedEvent() +205    Infragistics.Web.UI.GridControls.GridBot.HandleRaisePostDataChangedEvent() +73    Infragistics.Web.UI.Framework.Data.FlatDataBoundControl.RaisePostDataChangedEvent() +37    System.Web.UI.Page.RaiseChangedEvents() +165    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1485 -------------------------------------------------------------------------------------------------- Has anyone encountered this before? If so is there a solution to prevent this from occurring? Thank you for your help.