Last post Jul 13, 2012 01:00 PM by superguppie
Jul 04, 2012 11:15 AM|sayedaly|LINK
I have griview with all functionalities like Insert/Delete/Update and Cancel the records. No two users should manipulate(Insert/Delete/Update and Cancel) the records at the same time. With C# Code-Behind how to achive this. Please suggest me.
Jul 04, 2012 12:12 PM|Basquiat|LINK
Configure the Gridview's datasource. Select the "Advanced" button and then tick "Use optimistic concurrency"
Jul 04, 2012 06:15 PM|Krishna Pramod|LINK
There is no need of writing c# code you can achieve this using optimistic concurrency selected in the advanced while configuring data source
Jul 05, 2012 05:08 AM|hafizzeeshan|LINK
Check it, i hope it will work for uu
Jul 09, 2012 12:16 PM|superguppie|LINK
Optimistic concurrency is for detecting things like this. To really make it impossible, you would have to write your own locking mechanism. However, due to the unpredictable nature of web interfaces, it is hard to get this working well. (A user can close
a browser while editing a record. How to get rid of the lock then?)
Jul 10, 2012 06:21 AM|sayedaly|LINK
Thanks for the replies. I have implemented optimistic concurrency. Anyhow as you said how to avoid such scenarios like closing the browser while editing a record. Any ideas please.
Jul 13, 2012 01:00 PM|superguppie|LINK
With optimistic concurrency, there should not be a problem. Whenever a user edits something someone else has already edited, this will be detected upon update. Then a proper response can be done. (Like resolving the differences.)
For locking, locks are typically deleted after a certain timeout. The period will have to be long enough for an actual edit, but not too long to keep the record locked. (Anyone who wants to edit a record that is already locked will not be able to do so.)
You could make the period shorter by putting an UpdatePanel with a Timer in your page. Give the timer a period like 5 seconds. In the Tick handler, keep the lock alive. When the browsers is closed, the lock won't be kept alive.