PrM-beginrequest event
• Parameter type: beginrequesteventargs
-Request attribute: used to obtain the webrequest object (for Request Information)
-Postbackelement: Dom element that triggers asynchronous refresh
• Common Operations:
-Read Request Information
-Change the Request Method (replace executor)
-An update prompt is displayed.
Force updateprogress display
Aspx<ASP: Content ID="Content1"Contentplaceholderid="Contentplaceholder1"Runat="Server">
< ASP: updatepanel ID = " Updatepanel1 " Runat = " Server " >
< Contenttemplate >
<% = Datetime. Now %> < BR />
< ASP: button ID = " Button1 " Runat = " Server " Text = " Button1 " Onclick = " Button_onclick " />
</ Contenttemplate >
< Triggers >
< ASP: asyncpostbacktrigger controlid = " Button2 " />
</ Triggers >
</ ASP: updatepanel >
< ASP: updateprogress ID = " Updateprogress1 " Runat = " Server " Displayafter = " 0 " Dynamiclayout = " False "
Associatedupdatepanelid = " Updatepanel1 " >
< Progresstemplate >
< SPAN Style = " Color: red " > Loading </ Span >
</ Progresstemplate >
</ ASP: updateprogress >
< HR />
< ASP: button ID = " Button2 " Runat = " Server " Text = " Button2 " Onclick = " Button_onclick " />
< Script Language = " Javascript " Type = " Text/JavaScript " >
SYS. webforms. pagerequestmanager. getinstance (). add_beginrequest (
Function (sender, E)
{
If (E. get_postbackelement (). ID ! = " <% = This. button2.clientid %> " )
{
Return ;
}
VaR updateprogress = $ Get ( " <% = This. updateprogress1.clientid %> " );
VaR dynamiclayout = <% = This . Updateprogress1.dynamiclayout. tostring (). tolower () %> ;
If (Dynamiclayout)
{
Updateprogress. style. Display = " Block " ;
}
Else
{
Updateprogress. style. Visibility = " Visible " ;
}
});
</ Script >
</ASP: Content>
CSProtected VoidPage_load (ObjectSender, eventargs E)
{
}
protected void button_onclick ( Object sender, eventargs e)
{< br> thread. sleep ( 2000 );
}