2

I am new to web development and working on web project. In web project I want to show the Loader image on the postback of the page irrespective of the which control caused the postback.

Currently I have wrote one javascript method which shows the loader image pop up. And I have to set each controls OnClientClick= mypopupmethod() event. And I have lots of pages and controls which are causing the postbacks. So it just seems wrong to do all this way. Is there any way I can catch all the postback calls on page. I tried to tweak the '__doPostback' but I was not able to get to work.

So what I want is way to catch all the postback event on page or complete application by single method. and just call my mypopupmethod() in there. I am not expecting to get exact code but if any one could just point me in right direction should be enough.

In case of any confusion please feel free to comment.

user2745246
  • 304
  • 1
  • 3
  • 14

1 Answers1

0

Possible answer as mentioned in How to intercept any postback in a page? - ASP.NET

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.

var __original= __doPostBack;
__doPostBack = myFunction(){
mypopupmethod();
__original();
};

This replaces the __doPostBack function with your own, and you can call the original from your new one.

Community
  • 1
  • 1
kwangsa
  • 1,701
  • 12
  • 16