点击打开模态窗口,操作后提交关闭模态窗口并刷新父页面
如何用好模态窗口,一直以来是困绕我的地方,近期在一发一个项目,其中要使用模态窗口来完成数据调整任务,下面将使用经验总结一下。
A.aspx

以上代码关键之处:var k=模窗代码;if(k==1){window.location.href=window.location.href;}
B.aspx
1 <!--只列出关键代码 .aspx-->
2 <meta http-equiv="pragma" content="no-cache">
3 <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
4 <head>
5 <base target="_self">
6 </head>
7 <body>
8 <asp:Button ID="btnUploadPic" runat="server" Text="上传" onclick="btnUploadPic_Click" />
9 </body>
2 <meta http-equiv="pragma" content="no-cache">
3 <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
4 <head>
5 <base target="_self">
6 </head>
7 <body>
8 <asp:Button ID="btnUploadPic" runat="server" Text="上传" onclick="btnUploadPic_Click" />
9 </body>
以上代码关键处: <base target="_self">
B.cs
1 protected void btnUploadPic_Click(object sender, EventArgs e)
2 {
3 Response.Write("<script>alert('上传成功');window.returnValue=1;window.close();</script>");
4 }
2 {
3 Response.Write("<script>alert('上传成功');window.returnValue=1;window.close();</script>");
4 }
以上代码关健处,当然是Response.Write(...);