Asp.net Ajax regularly refreshes the page, and then a window pops up in the timer event.

Source: Internet
Author: User

Below is aspxCode:

 

< 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 = " Timerw.tick " >
</ ASP: Timer >
</ Contenttemplate >
</ ASP: updatepanel >
</ Div >
</ Form >
</ Body >

The following code is Aspx. CS:

 

Protected   Void Timereffectick ( 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 ('prompt: product added successfully! '); If (confirm (' do you want to add more? Cancel going to product management page ') {alert ('add more on this page')} else {open ('productmanage. aspx ',' _ Self ');} ", true );
}

 

In Aspx. CS:

The first method is to use the showmodaldialog method to pop up the modal window.

The second method is to use window. Open to pop up the window.

The third method is to pop up the window, and execute different results for different confirmation examples.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.