[RESOLVED] Gridview getting out of synch with source data

The Patient Scheduling system I have built extracts current inpatient data from an enterprise health system and merges it with data from a seperate database, based on a common key. This is then displayed in a gridview control for browse/update.

At any one point in time, the client list in my system should reflect the current inpatients in the enterprise system.
The problem is that if the user has not refreshed the client list in some time, there may have been a discharge in the enterprise system and the two get out of synch. When the user selects a client from the list to update, the details of an entirely different client (usually the one below), is presented in edit mode. e.g. if the user selects  the 4th client in the list, the details for the 5th client are made available for update. 

Any thoughts on how I can get around this.

One option would be to not edit within the GridView itself, and use the DetailsView / FormView combination (with or without a ModalPopupExtender if you will, to make it "user-friendly").
But that will ensure the GridView doesn't bind over its data source again. You would use the RowCommand or SelectedIndexChanged events.
Even though the details might load with changes, IF any applied by someone else in the meantime, which might be quite different to those displayed in the GridView row.

 

Another option might be to find the RowIndex that matches the value by ID (DataKeys) chosen to be edited (besides, this might be on anther page entirely). 

 

 

Madog

e.g. if the user selects  the 4th client in the list, the details for the 5th client are made available for update. 

looks like, in the meantime, somebody else deleted a record

 

Madog

The problem is that if the user has not refreshed the client list in some time,

I think it's a tall order to expect the GridView to take responsibility to sync-up over such unusually long time periods (or any other control for that matter).

(You could have your users refresh the GridView if they've been away too long! ;))

Thanks for your replies.

I understand its not the gv's fault, but just require a workaround. The gv is contained within an AJAX udpatepanel, so the approach I am taking at the moment is to assess the performance impact of databinding the gv on a regular interval using a timer.

If that doesn't work out, I plan to extract the key field in rowcommand (which takes place before rebinding over the datasource), and compare it to the key field on rowupdating (or perhaps preRender), and cancel the update if they are different, throwing a message box to the user.

thoughts on "[RESOLVED] Gridview getting out of synch with source data"

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>