Method is fired. What I wna to do is ccheck that the user has made any changes, if they havent pop up an cofirm box which exits the method if they cancel and redirects to another page if they confirm (bypassing the rest of the script.
I have my If statement which checks if anything has changed - how do i do the rest?
Visual Studio will have an issue with it in the code highlighting, but when the page actually runs on the server - it works. I have used that method in the past.
I imagine it has to do with a control being placed in a script tag that isn’t set to runat the server, but I have used that in the past.
Or, for a way that VS won’t complain about…just put the Literal control in your HTML page (not surrounded by the javascript tags) and in your codebehind use:
ltlJSConfirm.Text == “<script type=”“text/javascript”“>alert(‘Are you sure?’)</script>”
Do it without javascript first. They click the button you check it and if necessary redirect to a page that asks them if they are sure etc.
Later after reading up on ajax you can layer your script on top of this to make an ajax call to your logic in the code behind and avoid the need to redirect and it will work with script on or off.