ASP.NET验证未在JavaScript showModalDialog调用中执行
目前,我使用JavaScript.showModalDialog函数从父页面打开一个弹出窗口。弹出窗口包含一些ASP.NET验证控件,当用户单击ASP.NET按钮提交表单时,这些控件不会显示。如果页面上有错误,则不会显示验证消息,服务器端不会更新记录,弹出窗口将关闭 (asp.net验证控件不会阻止弹出窗口执行服务器回发) 以前有没有人体验过这种行为,有没有办法防止 以下是我的showModalDialong呼叫源代码:ASP.NET验证未在JavaScript showModalDialog调用中执行,asp.net,javascript,validation,modalpopups,showmodaldialog,Asp.net,Javascript,Validation,Modalpopups,Showmodaldialog,目前,我使用JavaScript.showModalDialog函数从父页面打开一个弹出窗口。弹出窗口包含一些ASP.NET验证控件,当用户单击ASP.NET按钮提交表单时,这些控件不会显示。如果页面上有错误,则不会显示验证消息,服务器端不会更新记录,弹出窗口将关闭 (asp.net验证控件不会阻止弹出窗口执行服务器回发) 以前有没有人体验过这种行为,有没有办法防止 以下是我的showModalDialong呼叫源代码: function OpenChildWindow(id) { va
function OpenChildWindow(id)
{
var sFeatures = sFeatures="dialogHeight: 525px;";
sFeatures += "dialogWidth: 900px;";
sFeatures += "scroll: yes;";
sFeatures += "status: no;";
sFeatures += "resizeable: no;";
var url = "MyPopUp.aspx?ID=" + id;
var childName = "ChildForm";
entryWindow = window.showModalDialog(url, childName, sFeatures);
if (entryWindow == true)
{
window.document.getElementById("<%= btnUpdateParent.ClientID %>").click();
}
}
函数OpenChildWindow(id)
{
var sFeatures=sFeatures=“dialogHeight:525px;”;
sFeatures+=“对话框宽度:900px;”;
sFeatures+=“滚动:是;”;
sFeatures+=“状态:否;”;
sFeatures+=“可调整大小:否;”;
var url=“MyPopUp.aspx?ID=”+ID;
var childName=“ChildForm”;
entryWindow=window.showModalDialog(url、子名称、sFeatures);
if(entryWindow==true)
{
window.document.getElementById(“”)单击();
}
}
注意:当弹出模式关闭时,会“单击”一个ASP.NET按钮来更新父级上的ASP.NET UpdatePanel,以显示对弹出窗口中修改的记录所做的更改。我认为这可能是由于模式对话框和回发存在臭名昭著的问题。您可以尝试在使用window.showModalDialog打开的页面的head标记中添加以下内容
<base target="_self" />
提供一些代码将有助于解决您的问题。我已使用showModalDialog源代码更新了问题。在模式框中打开的我的页面正在使用由我的应用程序中的所有页面共享的母版页。我尝试添加到母版页,但没有成功。