asp.net AJAX 定期重新整理頁面,然後,在 Timer 的事件中快顯視窗

來源:互聯網
上載者:User

以下是 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 快顯視窗

第三種方法是快顯視窗,不同的確認然後執行不同結果的樣本

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.