Hello,
I have the next issue in my web application.
On server i'm sending to the client during a server event with registerdataitem a string -an url.
On client in pageloading i'm getting the url and showing into a popup window. This is the code:
var
wind=null;var
currenturl=null;var
i=0;Sys.Application.add_load(ApplicationLoadHandler);
function
ApplicationLoadHandler(sender, args){
//Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
Sys.WebForms.PageRequestManager.getInstance().add_pageLoading(pageLoadingHandler)
}
//function EndRequestHandler(sender, args)
function
pageLoadingHandler(sender, args){
var dataItems = args.get_dataItems();wind=document.getElementById(
'popupid');if (wind!=null)return;if (document.title.indexOf("Print")>=0)currenturl=dataItems[
'ctl00_currenturl'];elsecurrenturl=dataItems[
'currenturl']if (currenturl !=null )//show the popup{
wind=window.open(currenturl,
'popupid');//DeleteFile(dataItems['currenturl']);works fine only on ie this solution
}
}
The problem is that the ajax pagerequestmanager event is raised too many times making the popup to be created to many time and sometimes browser to run out of resources.
How could i fix it i mean the pagerequestmanager event to be raised normaly i mean once.
I 'm using ie 6.5
Thanks
Hi,
Please use try this code snippet:
Sys.Application.add_load(ApplicationLoadHandler)
function ApplicationLoadHandler(sender, args)
{
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (!prm.get_isInAsyncPostBack())
{
prm.add_pageLoading(pageLoadingHandler);
}
}
Hope this helps.
No comments:
Post a Comment