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 弹出窗口

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值