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
155
“[MissingRecordException]: Requested Record cannot be found by key” Exception.
posted

 

First  user  makes a select query on records (using sqldatasource with selectcommand).Mean while Second user update one of the record that is being displayed to first user. Records get updated successfully for second user. Now when First user try to perform delete action on same record (using sqldatasource,DeleteCommand). First user see “[MissingRecordException]: Requested Record cannot be found by key” Exception.

We tried tips from existing thread like assigning datasource on server side on page load , clearing datasource on row delete event and also setting property AutoCRUD="False”. Still we are receiving same error.

Parents
  • 220
    posted

    I had a similar issue - after spending quite a bit of time on this issue, I discovered that rebinding to a static variable (even though doing another get of the data to it) resulted as in the objectid for the datasource not getting updated so the datagrid wasn't 'truly' recognizing the rebind.  Doing a databind() wasn't refreshing the Key.  To resolve, I set a local variable to a copy of the updated datasource and did a rebind().  It worked for me and hope this helps you :)!

    System.Data.DataSet dNoticesNew = new System.Data.DataSet();

    dNoticesNew = dNotices.Copy();

    DGNotices.DataSource = dNoticesNew;

    DGNotices.DataBind();

Reply Children
No Data