1

How does the client know to send request to server only when the confirmation box result is ok and stay on page if cancelled? Also, is this mechanism any different in ASP.Net and ASP.Net MVC?

I want to know the internal working of when user clicks OK/cancel what happens internally. How does browser come to know it has to proceed to server call or close itself and do nothing?

What I have researched so far tells me, that on a web forms page, the Page.IsValid property is somehow responsible for browser to determine the outcome.Is it correct? Also what happens with MVC?

  • Sharing your research helps everyone. Tell us what you've tried and why it didn’t meet your needs. This demonstrates that you’ve taken the time to try to help yourself, it saves us from reiterating obvious answers, and most of all it helps you get a more specific and relevant answer. Also see How to Ask – gnat Mar 25 '14 at 10:12
0

If you want a request sent after a confirmation dialog is shown it's up to you, via client code, to do that. The browser will not take any initiatives for you there. On its own it only can tell it must send a request when a form is submitted, a link is clicked or a new address or search query is submitted. That's it. Other than that, it never knows.

So the answer to your question really is: Whatever happens after a user makes a choice in a confirmation box is on you. It's your code's responsibility to take appropriate action.

Usually your presentation layer will show confirmation dialogs with javascript and wait for input. When the user makes a choice, it gets processed by the code and the next step is executed depending on the choice. Again, remember that whatever happens then is up to you. For all there is, you could very well end up having the "Cancel" button click making a server request. There might be a very good reason for that: rollbacking an on-going transaction, going back to a specific page, etc...

It really all depends on your app design and requirements. If anything, pressing either OK or Cancel may even not lead to a query being made at all!

Now, on Page.IsValid, if you look at the documentation you'll find out that this tells if the validation server controls are all valid within the page. Depending on what you're trying to do here this might not even be related at all.

I hope you find that information useful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.