I want to only allow people to save over this document if they hit a button on the worksheet. I did this with the beforesave event and had no problem. The only issue is if they make changes and then just go and close the document. It will ask if they want to save the changes. I tried setting the displayalerts to false but that doesn't seem to work. I also don't want the file to be read only because I want them to be able to save the new values in the document by clicking the button. How can I have it close without asking for a save?
If you acheive what you want, they could make a lot of changes and forget to hit your save button... Then exit and loose all their changes w/o any warnings at all.
Are you sure that you want this? Would they??
If you really don't like the default message, then I would at least give them a chance to save by calling your own "Do you want to save changes?" message followed by your own version of Save (whatever you might be doing differently). I really would give them a chance to not lose all their work...
I'm definitely putting in my own message, I just wanted to avoid the default. Thanks for the help George; it works great. I'm not sure I quite understand what it's doing though. Is it fooling the document into thinking it was already saved?
And what in case a user don't want the changes he/she made, for instance because of possible mistakes. In that case people tend to close the file without saving changes and reopen it...
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET. subscribe