SYS. webforms. pagerequestmanager

Source: Internet
Author: User
<% @ Page Language = "C #" %>

<! Doctype HTML public"-// W3C // dtd xhtml 1.0 transitional // en"
Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<SCRIPT runat ="Server">

Protected VoidProcessclick_handler (Object sender, eventargs E)
{
System. Threading. thread. Sleep (2000 );
}

</SCRIPT>

<HTML>
<Head id ="Head1" Runat = "Server" >
<Title> pagerequestmanager beginrequest example </title>
<Style type = "Text/CSS" >
Body {
Font-family: tahoma;
}
Div. alertstyle
{
Background-color: # ffc080;
Top: 95%;
Left: 1%;
Height: 20px;
Width: 270px;
Position: absolute;
Visibility: hidden;
}
</Style>
</Head>
<Body>
<Form ID = "Form1" Runat = "Server" >
<Div>
<Asp: scriptmanager id = "Scriptmanager1" Runat = "Server" />

<SCRIPT type = "Text/JavaScript" Language = "JavaScript" >
SYS. webforms. pagerequestmanager. getinstance (). add_beginrequest (beginrequesthandler );
SYS. webforms. pagerequestmanager. getinstance (). add_endrequest (endrequesthandler );
Function beginrequesthandler (sender, argS)
{
VaR ELEM = args. get_postbackelement ();
Activatealertdiv ('visible ', 'alertdiv', ELEM. Value + 'processing ...');
}
Function endrequesthandler (sender, argS)
{
Activatealertdiv ('hiddd', 'alertdiv ','');
}
Function activatealertdiv (visstring, ELEM, MSG)
{
VaR adiv = $ Get (ELEM );
Adiv. style. Visibility = visstring;
Adiv. innerhtml = MSG;
}
</SCRIPT>

<Asp: updatepanel id = "Updatepanel1" Updatemode = "Conditional" Runat = "Server" >
<Contenttemplate>
<Asp: Panel id = "Panel1" Runat ="Server" Groupingtext = "Update panel" >
Last update:
<% = Datetime. Now. tostring () %>.
<Br/>
<Asp: button runat ="Server" Id = "Button1" TEXT = "Process 1" Onclick = "Processclick_handler" />
<Asp: button runat = "Server" Id = "Button2" TEXT = "Process 2" Onclick = "Processclick_handler" />
</ASP: Panel>
</Contenttemplate>
</ASP: updatepanel>
<Div id = "Alertdiv" Class = "Alertstyle" >
</Div>
</Div>
</Form>
</Body>
</Html>

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.