asp.net AJAX 定期刷新页面,然后,在 Timer 的事件中弹出窗口

以下是 aspx 代码:

ContractedBlock.gif ExpandedBlockStart.gif Code
 1None.gif<body>
 2None.gif    <form id="form1" runat="server">
 3None.gif        <asp:ScriptManager ID="ScriptManager1" runat="server" />
 4None.gif        <div>
 5None.gif            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
 6None.gif
 7None.gif                <ContentTemplate>
 8None.gif                    <asp:Timer ID="Timer1" runat="server" Interval="5000" OnTick="Timer1_Tick">
 9None.gif                    </asp:Timer>
10None.gif                </ContentTemplate>    
11None.gif            </asp:UpdatePanel>
12None.gif            </div>
13None.gif    </form>
14None.gif</body>

以下为 aspx.CS 代码:

ContractedBlock.gif ExpandedBlockStart.gif Code
1None.gifprotected void Timer1_Tick(object sender, EventArgs e)
2ExpandedBlockStart.gifContractedBlock.gif    dot.gif{
3InBlock.gif        
4InBlock.gif            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);
5InBlock.gif          //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);
6InBlock.gif          //ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('提示:产品添加成功!');if(confirm('是否继续添加?取消转到产品管理页')){alert('本页面继续添加')}else{open('productManage.aspx','_self');}", true);
7ExpandedBlockEnd.gif    }

aspx.CS 中:

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

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

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

转载于:https://www.cnblogs.com/zhangchenliang/archive/2008/03/04/1090388.html

猜你喜欢

转载自blog.csdn.net/weixin_33951761/article/details/93495964