I want to lock an ASP.NET Page when a user tries to edit value of any control on that Page. If he is just viewing it should be just fine. The moment he edits any of the fields the page should be locked and other users should be still be able to view but not edit it. Is there any inbuilt and easier way to do this in ASP.NET 4.0? Is it something we should do using client side JQuery/Javascript?
Edit:- Here is the needed scenario, if a user opens the Page and make changes to any of the fields in that Page, it should be locked, which marks a flag(User ID) on the DB. When other user tries to edit or make changes to a page, its displays a message that this page is locked and disables the Submit button. but if other user is only viewing and not making any other changes, This should be Okay.
Kindly let me know. I found that Onchange event can be used to do this but I have a question as I am new to ASP.NET? Is onchange event available for controls? and what exactly is the difference between html controls and their ASP.NET Counter parts.
Thanks,
If I understand you correctly, you will probably need a flag in the database to indicate whether the form is being edited and if so, by whom.
I think that it would be best to re-look what you are needing to do though and how you could achieve it another way. Dealing with concurrency is tricky but there must be better solutions.
Lastly, "what exactly is the difference between html controls and their ASP.NET Counter parts?"
ASP.NET server controls are basically written in ASP.NET markup and often bring in a whole lot of additional functionality over vanilla html elements. The most notable being the ability for them to be accessed server-side and retain state through something called ViewState. At run time, ASP.NET controls are rendered to vanilla html.