In .NET (C#, specifically), how can I stop navigation?
Situation: User has clicked a link and fired off the _Click() event.
The click event fires off a save method, which verifies some information. If any of the information isn't as desired, we want to stop the rest of the click event from occurring.
ASP.NET's built-in validation won't work in this instance. There are multiple different ways the forms could need to be filled out (and the form is built from several different controls, each used in multiple pages) depending on the initial state of the data. For instance, if they are hitting this form for the first time (and they've never added any information it contains before), NOTHING is required...but if they fill in anything, they must fill in (almost) everything.
With this much conditional logic in the validation, it's easier to just stick (empty) labels on the page and fill them with validation messages if needed, than to use actual validators.
Our problem is that the method that fires the Save() then moves the user to another page.
There's no return value we can use to specify 'stop navigation'...so how can I fire off the method, set the 'error' labels, and then prevent the call from going back up the stack (and sending the user away from the page)?