asp.net ajax:updatepanel tips and tricks

Source: Internet
Author: User
Tags http request

Directory

Update highlighting

Cancel UpdatePanel Update

Multiple UpdatePanel

Do not use UpdatePanel update

Web Service!= SOAP and XML

For better or worse, UpdatePanel controls are loved by the ASP.net AJAX community. I say "yes" because UpdatePanel makes some of the pages appear fairly simple and "bad" because it's simple and easy to use, at the expense of efficiency and ironic bandwidth.

UpdatePanel can bring Ajax magical benefits to a typical Web page, but it does not provide the efficiency that we normally associate with Ajax. For example, do you know that when the UpdatePanel control performs an asynchronous AJAX callback to the server to update its contents, the request contains everything that the general ASP.net postback contains, including view state? Most developers will assume that AJAX has canceled view state. And UpdatePanel's AJAX brand is not.

If you're ready to use the UpdatePanel control, you need to know what you're doing. In many cases, from a performance standpoint, an application is best not to use UpdatePanel, but rather to use asynchronous calls to WebMethods or page methods. Doing so may significantly reduce the amount of data in the network transport. However, it is also a fundamental shift where UI updates need to be explicitly handled by developers using JavaScript on the page.

In addition, ASP.net AJAX forums are littered with questions about custom UpdatePanel. In fact, if you understand the PageRequestManager and JavaScript classes in the Microsoft®ajax Library that provide client support for UpdatePanel, many of these problems can be solved.

Now that I've provided ASP.net AJAX, I'd like to examine the UpdatePanel further to see how you can customize and optimize it, even without it. This is exactly what this column contains.

Update highlighting

Sometimes you can't help Microsoft developers, and you can only express regret for them. If they fail to do their job well enough, they will be attacked by the public. Sometimes, however, they do a good job and are attacked. For example, I recently received an e-mail from a customer complaining that asp.net AJAX UpdatePanel is running a bit too far.

UpdatePanel makes the ASP.net page back to the server and turns it into a smooth, flicker-free update that flashes and flashes becomes extremely simple. UpdatePanel can play its magic by converting a postback to an asynchronous callback (Xml-http request) and using JavaScript on the client to refresh part of the page encapsulated by the UpdatePanel control. Flashes and flashes disappear because the browser does not redraw the page as it did during the postback.

The customer complains that the user sometimes doesn't notice that part of the page has updated the new content. His question is simple: can asp.net AJAX team staff make UpdatePanel blink a bit more so that users don't miss important updates?

Unfortunately, the ASP.net AJAX team may have little interest in making UpdatePanel flashes. After all, the elimination of flicker is the original intention of inventing UpdatePanel. But happily, you can use some of the magic features of AJAX in your browser to attract attention to the updated UpdatePanel. The secret is the Sys.WebForms.PageRequestManager class in the Microsoft Ajax Library, which consists of half of the client's ASP.net ajax libraries of JavaScript classes. PageRequestManager can manage asynchronous callbacks that are initiated by UpdatePanel. It is also responsible for updating the contents of the UpdatePanel after the asynchronous callback completes.

Related Article

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.