Whether it is good or bad, the UpdatePanel control is a favorite of the ASP. net ajax Community. I say "good" because UpdatePanel makes rendering some pages quite simple, but "bad" is because its simplicity and ease of use are at the cost of efficiency and ridiculous bandwidth.
UpdatePanel can bring AJAX magical benefits to general web pages, but it cannot provide the efficiency of normal association with AJAX. For example, do you know that when the UpdatePanel Control performs asynchronous AJAX callback on the server to update its content, this request contains the regular ASP. NET, including view status? Most developers think That AJAX cancels the view status. The AJAX brand of UpdatePanel does not.
If you want to use the UpdatePanel control, you need to know what you are doing. In many cases, from a performance perspective, it is better for an application to use Asynchronous calls to WebMethods or page methods instead of UpdatePanel. This may significantly reduce the amount of data transmitted over the network. However, it is also a fundamental change. Here, UI updates need to be explicitly processed by developers using JavaScript on the page.
In addition, questions about custom UpdatePanel are everywhere on the ASP. net ajax forum. In fact, as long as you know about Microsoft that provides client support for UpdatePanel? The PageRequestManager and JavaScript classes in the AJAX Library can solve many problems.
Now that ASP. net ajax is provided, I want to further check UpdatePanel to learn more about how you can customize and optimize it, and even how to run it without it. This is exactly what this column contains.
Update highlight
Sometimes you cannot help Microsoft developers, but you can only regret them. If they cannot do their jobs well enough, they will be criticized by the public. However, sometimes they do a great job and are under criticism. For example, I recently received an email from a Customer complaining that ASP. NET AJAX UpdatePanel is a little overrunning.
UpdatePanel enables ASP. NET pages to be sent back to the server and makes it extremely easy to flash and flash when it becomes a smooth, non-blinking update. UpdatePanel can exert its magic by converting the sending back to an asynchronous callback XML-HTTP request) and using JavaScript on the client to refresh Part of the page encapsulated by the UpdatePanel control. Flash and flash will disappear because the browser will not redraw the page as it is during the sending back.
The customer complained that the user sometimes does not notice that the part of the page has been updated. His question is simple: Can the ASP. net ajax team help
UpdatePanel flashes a little more so that users do not miss important updates?
Unfortunately, the ASP. net ajax team may not be interested in making UpdatePanel flashes. After all, eliminating flickering is the original intention of UpdatePanel. However, you can use some magical functions of AJAX in your browser to attract the attention of updated UpdatePanel. The secret lies in the Sys. WebForms. PageRequestManager class in the Microsoft AJAX Library, which is a JavaScript Library consisting of half of ASP. net ajax on the client. PageRequestManager can manage asynchronous callbacks started by UpdatePanel. It is also responsible for updating the content in UpdatePanel after the asynchronous callback is complete.
PageRequestManager can trigger events in the browser before and after the update. You can associate these events in JavaScript and run the code to remind users to update the content. The key event is named pageLoaded. This event will inspire the page in the browser to load it like Page_Load in ASP. NET every time ). It also triggers an asynchronous callback that represents the completion of the UpdatePanel control and updates the content in the UpdatePanel. You can use two lines of code to merge them into one line) to register the JavaScript handler for the pageLoaded event:
Var prm = Sys. WebForms. PageRequestManager. getInstance); prm. add_pageLoadedpageLoaded );
The first line gets a reference to the page's PageRequestManager object. The second line registers the JavaScript function named pageLoaded as the handler for the pageLoaded event.
During the call, the pageLoaded event handler receives a Sys. WebForms. PageLoadedEventArgs-type parameter, which is another class in Microsoft AJAX Library. PageLoadedEventArgs contains a get_panelsUpdated method. You can call this method to enumerate all updatepanels if any). The content has just been updated. By default, UpdatePanel is the DIV on the client. Therefore, you can use JavaScript to make the DIV flash, highlight it, or perform any operations you want on it, to remind users to pay attention to it.
- Analysis on ASP. NET Web Security
- Session State of ASP. NET
- Analysis on the attribute ASP. NET of IsPostBack
- ASP. NET architecture and security mechanism
- Overview ASP. NET Crystal Reports