Interrompere un AsyncPostBack

by Andrea 18 April 2007 00:04

In casi di operazioni lunghe fatte in PostBack asincrono (AsyncPostBack), può capitare di dare la possibilità all'utente di interrompere tale operazione, e ci viene in aiuto il metodo abortPostBack messo a disposizione dal PageRequestManager.

Per poterlo utilizzare, è sufficiente richiamare questa funzione da un pulsante che possiamo inserire all'interno del ProgressTemplate:

function CancelAsyncPostBack()
{
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    if(prm.get_isInAsyncPostBack())
		prm.abortPostBack();
}

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Ajax ASP.NET

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading