zoukankan      html  css  js  c++  java
  • asp.net AJAX 定期刷新页面,然后,在 Timer 的事件中弹出窗口

    以下是 aspx 代码:

    <body>
        
    <form id="form1" runat="server">
            
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
            
    <div>
                
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">

                    
    <ContentTemplate>
                        
    <asp:Timer ID="Timer1" runat="server" Interval="5000" OnTick="Timer1_Tick">
                        
    </asp:Timer>
                    
    </ContentTemplate>    
                
    </asp:UpdatePanel>
                
    </div>
        
    </form>
    </body>

    以下为 aspx.CS 代码:

    protected void Timer1_Tick(object sender, EventArgs e)
        {
            
                ScriptManager.RegisterClientScriptBlock(
    this.UpdatePanel1, UpdatePanel1.GetType(), "error""window.showModalDialog('Pop.aspx', 'newwindow', 'dialogWidth:400px;DialogHeight=300px;center: yes;help:no;resizable:no;status:no');"true);
              
    //ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, UpdatePanel1.GetType(), "error", "window.open ('Pop.aspx', 'newwindow', 'height=450, width=550, top=120,left=250, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');", true);
              
    //ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('提示:产品添加成功!');if(confirm('是否继续添加?取消转到产品管理页')){alert('本页面继续添加')}else{open('productManage.aspx','_self');}", true);
        }

    aspx.CS 中:

    第一种方法是用 showModalDialog 方法弹出模态窗口

    第二种方法是用 window.open 弹出窗口

    第三种方法是弹出窗口,不同的确认然后执行不同结果的示例

  • 相关阅读:
    C# 控制反转
    控制反转和依赖注入
    C#中使用AOP
    jquery ajax
    python(7)- 小程序练习:循环语句for,while实现99乘法表
    007所谓性格与条件并不是成功的阻碍,懦弱才是
    006学习有可能速成吗
    005自学与有人带着哄着逼着学的不同在于自学是一种成熟的自律
    005单打独斗意味着需要更好地管理自己
    004真正的教育是自我教育,真正的学习是自学
  • 原文地址:https://www.cnblogs.com/tiger8000/p/2215140.html
Copyright © 2011-2022 走看看