Clearing label in ContentPage without postback
I've got a bit of a problem. My application communicates with BizTalk to extract data from a database, passing in a key value from the UI which is used for the look up. I have a couple of regEx checks in the UI to make sure that the user enters a correctly formatted key value. If they don't, any input errors is caught in the UI-validation and no postback occurs. The errors are displayed next to the input field in question as well as in a validation summary located in the master page.
My problem is that if the user enters a correctly formated key value and submits, and BizTalk returns an error, this error is presented in a label on the content page, just below the submit button. If the user then proceeds to enter a new key value, but doesn't type it in in a correct format, the UI-validation kicks in and no postback occurs, and the previous server error is displayed even though it is no longer accurate as the server side code that clears the label is never reached. What I want to do (and have failed miserably to achive so far) is to hide the label on the content page using JavaScript when the client side validation prevents a post back. This should only happen when the validation fails and no post back occurs. When I register a script in the content page's load event, the JavaScript to hide the label always fires, which means that the server errors are never presented to the user. Any ideas on how to achieve this?
Summary; I only want the JavaScript that clears and hides the label t开发者_如何学Goo run when no postback occurs.
Using jquery:
$("#message").hide();
That will hide the div with id="message".
精彩评论