Copy codeThe Code is as follows: <! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head id = "Head1" runat = "server">
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Link href = "/Style/NiuLan.css" rel = "stylesheet" type = "text/css"/>
<Title> </title>
<Script type = "text/javascript"> // when the page is refreshed, the original display data on the page is not hidden. This is a hidden function.
// Obtain the PageRequestManager object. Each Asp.net Ajax page will have a unique object on the right to handle all Async-Postback requirements.
Var prm = Sys. webForms. pageRequestManager. getInstance (); // the newly added event is processed to the initializeRequest event of PageRequestManager. When Async-Postback occurs, this event is triggered and our InitRequest function is run.
Prm. add_initializeRequest (InitRequest );
// Add an event to process the endRequest event of PageRequestManager. When Async-Postback is complete, this event is triggered and our EndRequest function is run.
Prm. add_endRequest (EndRequest); function InitRequest (sender, args ){
// Display the UpdateProgress1 Control
Document. getElementById ('detail'). style. display = "none ";
}
Function EndRequest (sender, args ){
// Hide the UpdateProgress1 Control
Document. getElementById ('detail'). style. display = "block ";
}
// Cancels the Async-Postback action.
Function CancelClick (){
// When it is in the Async-Postback action, the get_isInAsyncPostBack function returns true. Then, the Async-Postback action is canceled when the abortPostBack function is called.
If (prm. get_isInAsyncPostBack ()){
Prm. abortPostBack ();
}
}
</Script>
</Head>
<Body>
<Form id = "Form1" runat = "server">
// Use ScriptManager in Ajax Extensitons
<Asp: ScriptManager runat = "server">
</Asp: ScriptManager>
// Usage example
<Asp: UpdatePanel ID = "UpdatePanel1" runat = "server">
<ContentTemplate>
// Put the code
<Div id = "detail"> <asp: ImageButton ID = "ibtnFBSJ" runat = "server" ImageUrl = "/images/ershoufang/bs/fbsj.gif"
OnClick = "ibtnFBSJ_Click"/>
</Div>
// When the page is refreshed statically, The UpdateProgress will be called, but this background also requires code. See the following:
<Asp: UpdateProgress ID = "UpdateProgress1" runat = "server" AssociatedUpdatePanelID = "UpdatePanel1">
<ProgressTemplate>
<Div style = "text-align: center">
</Div>
</ProgressTemplate>
</Asp: UpdateProgress>
</ContentTemplate>
</Asp: UpdatePanel>
</Form>
</Body>
</Html>
Background
Protected void ibtnFBSJ_Click (object sender, ImageClickEventArgs e)
{
System. Threading. Thread. Sleep (2000 );
DrpSortOrder. SelectedValue = (int) ErShouFangJiChuZuFang. order. sort by release time). ToString ();
PopulateDetails ();
}
// In this way, the page can be refreshed statically, with images rotated during loading. The user experience will be very good as follows:
Of course, you can also use jquery or ajax to write and dynamically load tables.