I want to intercept any postbacks in the current page BEFORE it occurs . I want to do some custom manipulation before a postback is served. Any ideas how to do that?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There’s a couple of things you can do to intercept a postback on the client.
The __doPostBack function looks like this:
Notice that it calls “theForm.onsubmit()” before actually doing the postback. This means that if you assign your form an onsubmit javascript function, it will always be called before every postback.
Alternately, you can actually override the __doPostBack function and replace it with your own. This is an old trick that was used back in ASP.Net 1.0 days.
This replaces the __doPostBack function with your own, and you can call the original from your new one.