• 非模态页面刷新父页面实现


    原理:在子页面调用父页面中的方法,该方法刷新父页面:

    父页面:

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
      <script type="text/javascript">
          var resh = function () {
              alert("父页面刷新了!");
              location.reload()
          }
          var open1 = function () {
              //window.open("DefaultFrom.aspx");
              window.open("DefaultFrom.aspx", "", "width=400,height=400");
              //window.open('DefaultFrom.aspx', 'newwindow', 'height=100,width=400,top=0,left=0,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no') 
    
          }
      </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
         <input type="button" value="弹出非模态页面" onclick="open1()" />
        </div>
        </form>
    </body>
    </html>


    子页面前台:

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="DefaultFrom.aspx.cs" Inherits="DefaultFrom" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        
            <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="点击按钮提交后,关闭当前页面并刷新父页面" />
        
        </div>
    
    
        <script type="text/javascript">
        '<%if(isSubmit) {%>'
            window.opener.resh();
            window.close();
       ' <%} %>'
        </script>
        
        </form>
    </body>
    </html>

    后台

    using System;
    using System.Collections.Generic;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    public partial class DefaultFrom : System.Web.UI.Page
    {
        protected bool isSubmit = false;
        protected void Page_Load(object sender, EventArgs e)
        {
    
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            isSubmit = true;
        }
    }
  • 相关阅读:
    Tensorflow的对二次函数的神经网络训练
    ubuntu16.04的Anaconda下的tensorflow安装py3.5
    数字信号处理C语言(3) ------FFT
    数字信号处理C语言(2) ------带高斯噪声的sin函数和组合sin函数
    数字信号处理C语言(1) ------均匀分布和高斯分布随机数
    CCIE学习笔记 ----TSHOOT
    CCIE学习笔记 ----BGP
    CCIE学习笔记 ----GRE over IPsec
    调试
    Java protobuf框架使用向导
  • 原文地址:https://www.cnblogs.com/zhangxiaolin/p/js.html
Copyright © 2020-2023  润新知