[英]Facing Issue with ShowModalDialog
I want to display the webpage as a modal popup. 我想将网页显示为模式弹出窗口。
Response.Write("<script type='text/javascript'>detailedresults=window.showModalDialog('NewFile.aspx','Data','left=(screen.width) ? (screen.width - 800) / 2 : 0,top=(screen.height) ? (screen.height - 700) / 2 : 0,width=1000, height=500, toolbar=no, menubar=no, titlebar=no, location=no, addressbar=no');</script>");
While using the above code. 同时使用上面的代码。 I am able to display web page as modal popup, but the issue is that it also opens a third window which is a web page of same name and not a modal popup.
我可以将网页显示为模式弹出窗口,但问题是它还会打开第三个窗口,该窗口是同名网页而不是模式弹出窗口。
Please help me in resolving this issue. 请帮助我解决此问题。 Thanks in Advance.
提前致谢。
Rather than writing the script out to the response use RegisterStartupScript
instead: 与其将脚本写出到响应中,不如使用
RegisterStartupScript
:
Page.ClientScript.RegisterStartupScript(this.GetType(),
"detailedresults",
"<script type='text/javascript'>detailedresults=window.showModalDialog('NewFile.aspx','Data','left=(screen.width) ? (screen.width - 800) / 2 : 0,top=(screen.height) ? (screen.height - 700) / 2 : 0,width=1000, height=500, toolbar=no, menubar=no, titlebar=no, location=no, addressbar=no');</script>");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.