我想实现这样的效果,在A.aspx页面上有个按钮,点此按钮后弹出一相模态对话框,
<script language="javascript">
function OpenAddNew(){
window.showModalDialog("AddNews.aspx","","location:No;status:No;help:No;dialogWidth:50;dialogHeight:30;scroll:Yes;");
}
</script>
加载一个页面AddNews.aspx,然后在这个AddNews.aspx实现增加并保存一条数据库纪录后退出对话窗体:
<script runat="server"> Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim S As String = "<script langage=javascript>window.close();<" & "/script>"
RegisterClientScriptBlock("JS1", S)
End Sub
</script><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
<asp:Button ID="BtnSave" runat="server" Text="保存" OnClick="Button1_Click" /> </div>
</form>
</body>
</html>
但现在模态对话窗弹出后,用上面的代码关闭不了,请问这个是为什么,要怎么解决?
<script language="javascript">
function OpenAddNew(){
window.showModalDialog("AddNews.aspx","","location:No;status:No;help:No;dialogWidth:50;dialogHeight:30;scroll:Yes;");
}
</script>
加载一个页面AddNews.aspx,然后在这个AddNews.aspx实现增加并保存一条数据库纪录后退出对话窗体:
<script runat="server"> Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim S As String = "<script langage=javascript>window.close();<" & "/script>"
RegisterClientScriptBlock("JS1", S)
End Sub
</script><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
<asp:Button ID="BtnSave" runat="server" Text="保存" OnClick="Button1_Click" /> </div>
</form>
</body>
</html>
但现在模态对话窗弹出后,用上面的代码关闭不了,请问这个是为什么,要怎么解决?
window.parent.location.href.onload()刷新父窗口!好象是这样!