关闭名为Window的ShowModialDialog后,不会触发父窗口的加载事件。 [英] Parent window's load event not fired after closing a ShowModialDialog called window.

查看:77
本文介绍了关闭名为Window的ShowModialDialog后,不会触发父窗口的加载事件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


您好



我正在通过window.ShowModalDialog打开一个页面,我打开这个页面有两个场景,一个用于在db中添加记录,另一个用于编辑记录。这两种情况的查询字符串是不同的。



我有两个函数用于打开要添加的页面,一个用于打开页面进行编辑。


在modalDialoog状态下打开页面的语句之后,我调用window.location.reload,以便可以刷新父页面。



在关闭为编辑打开的ModalDialog页面时,我遇到了一个奇怪的问题,即父窗口的加载没有被触发。


关闭为添加记录而打开的ModalDialog窗口后,页面会刷新。



< p align = left>我用于打开添加和编辑的代码如下。



function btnOpenForEdit(customerId)


{


var sCustomWinParams = " dialogWidth:725px0px; dialogHeight:525px0px; help:0; status:0; scroll: 0;中心:1;可调整大小:否;"


var sPath = " MyPage.aspx?CustomerId =" + customerId ;


var args;


var objlookup = window.showModalDialog(sPath,args,sCustomWinParams);


window.location.reload();


}




功能 btnOpenForAdd()


{


var sCustomWinPar ams = " dialogWidth:725px0px; dialogHeight:525px0px; help:0; status:0; scroll:0; center:1; resizable:no;"


var sPath = " MyPage.aspx?ProductId =" + document.getElementById( "" hdnProductId" )。value;


var args;


var objlookup = window.showModalDialog(sPath,args,sCustomWinParams);


window.location.reload();


}




我很乐意帮忙。



问候,


Haris Munawar

解决方案

< p align = left>


您能告诉我们如何为onload事件分配函数吗?


您可以在onload代码的开头放置一个简单的警报,以确认在编辑操作的情况下代码没有运行吗?



 

Hi

 

I am opening a page by window.ShowModalDialog, I open this page for two scenarios one for adding a record in db and one for editing a record. The querystring for both cases is different.

 

I have two functions one for opening the page for adding and one for opening the page for editing.

Right after the statement for opening the page in modalDialoog state I call window.location.reload so that the parent page can be refreshed.

 

I am facing a strange problem of parent window's load not being fired after closing a ModalDialog page opened for edit.

The page does get refreshed after closing the ModalDialog window opened for adding the record.

 

The code I am using for opening for adding and editing is as follows.

 

function btnOpenForEdit(customerId)

{

var sCustomWinParams = "dialogWidth:725px0px;dialogHeight:525px0px;help:0;status:0;scroll:0;center:1;resizable:no;"

var sPath="MyPage.aspx?CustomerId=" + customerId;

var args;

var objlookup = window.showModalDialog(sPath,args,sCustomWinParams);

window.location.reload();

}

 

function btnOpenForAdd()

{

var sCustomWinParams = "dialogWidth:725px0px;dialogHeight:525px0px;help:0;status:0;scroll:0;center:1;resizable:no;"

var sPath="MyPage.aspx?ProductId=" + document.getElementById("hdnProductId").value;

var args;

var objlookup = window.showModalDialog(sPath,args,sCustomWinParams);

window.location.reload();

}

 

 

I'll be greatful for help.

 

Regards,

Haris Munawar

解决方案

 

Can you show us how you assign a function to the onload event?

Can you place a simple alert at the beginning of the onload code to confirm that the code doesn't run in the case of the edit operation?

 


这篇关于关闭名为Window的ShowModialDialog后,不会触发父窗口的加载事件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆