... Preface
The introduction of Ajax in Web applications not only improves user experience (partial page refreshing), but also reduces the workload and response time of web servers to a certain extent.
Ajax uses JavaScript to initiate a request to the server (Web Server) Over HTTP (s) on the client (browser). Based on the Request URI, the server,
Complete the corresponding logical operation, and then return the result to the client through HTTP (s) protocol.
The client parses and renders the returned results (text/XML strings) in callback using JavaScript.
... ASP. NET Ajax Server Control
In early ASP, PHP, and JSP development, the busy XMLHttpRequest is common in Ajax.
XMLHttpRequest in Ajax
Function loadxmldoc (URL ){
If (window. XMLHttpRequest ){
Req = new XMLHttpRequest ();
} Else if (window. activexobject ){
Req = new activexobject ("Microsoft. XMLHTTP ");
}
If (req ){
Req. onreadystatechange = processreqchange;
Req. Open ("get", URL, true );
Req. Send (null );
}
}
Today, we can choose more JavaScript frameworks such as jquery and ext js to reduce the workload of Ajax development.
ASP. net (3.5 and above, 2.0 and below require the installation of Ajax extension) provides a set of Ajax server-side controls (in fact, that is, five, scriptmanger, scriptmanagerproxy, timer, updatepanel, updateprogress ), to simplify Ajax development. Using ajax Control Toolkit does save a lot of trouble.
... Updateprogress
In the Ajax Server Control, updatepanel is a big thing. After page requests are completed, you will find that only content in updatepanel is updated,
Objects other than updatepanel remain unchanged.
Even so, before the updatepanel completes the update, the friendly method is to prompt the user to be cautious and the request is being processed.
... Updateprogress flaws
Updateprogress is useful, but it also has some flaws.
In the following example, you click the "filter" button and use modalpopupextender In the Ajax toolkit to bring up the search condition window;
In the pop-up window, click "OK" to submit the Ajax request.The progress bar is not displayed on the top.And is oftenYou cannot see it in the pop-up window.
... Solution
The following describes my practices:
Method 1)
Add an updateprogress template copy to the Panel associated with modelpopupextender. As follows:
Code
<Div id = "divfilteringloader" runat = "server" class = "loader" style = "display: none;">
<Div class = "loadercontent"> <asp: Label runat = "server" id = "lblloading" text = "<% $ pppresources: Main, loading %> "> </ASP: Label> </div>
</Div>
Then, when the user clicks "OK", the client triggers:
$ Get ("<% = divfilteringloader. clientid %>"). style. Display = 'block ';
Method 2)
When you click "OK", the client triggers the Click Event of the cancel button:
$ Get ("<% = btnfiltercancel. clientid %>"). Click ();
... Summary
The problem is simple, and the solution is simple.
Do friends in the garden have the same problem?
I also hope to actively contribute some methods and ideas.