ASP.NET ObjectDataSource Control and Concurrency Handling
ASP.NET data source controls sever are used within an ASP.NET pages, and use them to connect to a data source, such as SQL Server, XML files, etc. It then allows us to bind to it a UI control, such as a GridView. They are extremely easy to use on one hand, but they’re not being used in a real world scenario, since they bring us back (almost) to the “old world” 2-tiers application architecture, in which the client directly connects to the data source.
One data source control should be used is the ObjectDataSource, which enable us to connect to an object on the server, provide a name of a method, and that’s about it…
But what about concurrency? What happens when more than user tries to update the same record in the data store?
I would like to recommend two complimentary solutions I found at Visual Studio Magazine (though using VB.NET) one for Concurrency Handling and one for Concurrency Handling with ObjectDataSource. Combine the solutions in these two articles can save you a lot of time, not to mention many lines of un-readable code.