Skip to content Skip to sidebar Skip to footer

How To Control Or Stop Partial Post Back In Update Panel

I have been using update panels , all i need is whenever a partial post back is done , i need to check for a condition which decides whether to proceed that post back to server or

Solution 1:

I will provide you a solution about that matter in 1 example.

There is a begin ,end and initialize events for the update panel partial post back and it attached as follow

function pageLoad(sender, arg) {
    if (!arg.get_isPartialLoad()) {
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(update_begin);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(update_end);
Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(ControlMyPostBack);
          }
        }

 function update_begin(sender, args) {
        }

 function update_end(sender, args) {
        } 

function ControlMyPostBack(sender, args)
       {
        if(condition)
           {
           //abort my partial post back
           args.set_cancel(true); 
           } 
       }

in these 3 functions, you can control your partial post backs and also this line can stop your post back but I think it's only in async case

Sys.WebForms.PageRequestManager.getInstance().abortPostBack();

Post a Comment for "How To Control Or Stop Partial Post Back In Update Panel"