Question

Inside an UpdatePanel I have two PlaceHolders which are never visible at the same time. In one PlaceHolder I let the user choose an article to edit and when an article is selected it is displayed in the other PlaceHolder. When this happens is set the visibility of the first one to false and turn the other one on.

Now, when the user edits the article there are some fields and two buttons: one button is labeled "OK" and is used to send the form data to the server and the other button is labeled "Cancel" and is used to. It is only when the user clicks the OK-button that I need to send the form data to the server since this is the only situation where bother to handle it. Therefore, can I let the system know that the it should not send form data when the Cancel-button is clicked?

The issue was brought up because at first, I got a RequestValidation-error from the tinyMCE-component that is used for the body of the article (since it contains HTML), when I clicked the Cancel-button. Now I have turned off RequestValidation for this page and I do the validation manually.

But anyway, can I turn off form-data-sending when the Cancel-button is clicked?

Was it helpful?

Solution

Maybe if you prevent the postback when clicking the Cancel button you'll disable the form-data sending. This could be achieved by subscribing to the OnClientClick event of the button and type return false as a value.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top