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
345
WebDataGrid Requested record cannot be found by key
posted

I have a WebDataGrid which includes a checkbox.  The rows of the grid are dependant on a selection from a drop down list, so I repopulate the datasource on the list's SelectedIndexChanged trigger.  As long as no checkbox in the grid is checked, this works fine.  However, if I check a checkbox I get the error "Requested record cannot be found by key".  (See Stack Trace at the end of this post.)

I've tried several things.  I added a handler for the grid's OnRowUpdating.  However, this error is thrown before that function is reached.  (I put a breakpoint in and deliberately selected a record that would appear again after I changed the drop down list selection.  The breakpoint was hit in that case, and I did not get the error.  When I selected an option that did not include that record, the breakpoint was NOT hit before the error was thrown.)

I set the Behavior Core's AutoCRUD to false, made no difference at all.

I added a function for OnPreRender and only cleared and reset the datasource in that function.  Still got the error.

Help!  I've been working on this for 2 days and I'm stuck.  I actually don't want the grid to try to update the datasource AT ALL.  (Like, EVER.  The checkbox is used solely to determine which values to include when running a report, NOT to update the database in any way, shape or form.)  Any way to get it to not even try???

[MissingRecordException: Requested record cannot be found by key.
Common Causes:
- The data key field(s) is being edited causing the record not to be found when trying to update.
- Not rebinding the grid when there are updates to be committed (assuming DataViewState is disabled in this case) – for instance if the grid is bound on !IsPostback.
- While a user is editing a particular row in the grid, another user deletes the record from the database. On posting back, the grid is rebound to the updated datasource which no longer contains the record, resulting in the exception.
- Changing completely or filtering the grid’s datasource before all CRUD operations are carried out – this is quite common when using other controls on the page to do this . This is partly due to the fact that control events such as SelectedIndexChanged for a dropdownlist or Click for a button fire before the updating events. Changing the grid’s source should in such cases be delayed for later (PreRender).]
   Infragistics.Web.UI.GridControls.EditingCore.OnAction(String actionType, Object id, Object value, Object tag) +1037
   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) +1312
   Infragistics.Web.UI.Framework.RunBot.HandleRaisePostDataChangedEvent() +226
   Infragistics.Web.UI.GridControls.GridBot.HandleRaisePostDataChangedEvent() +78
   Infragistics.Web.UI.Framework.Data.FlatDataBoundControl.RaisePostDataChangedEvent() +37
   System.Web.UI.Page.RaiseChangedEvents() +132
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1644


Parents Reply Children
No Data