ASP. NET UpdatePanel update

Source: Internet
Author: User

Multiple UpdatePanel

A page can host several updatepanels. By default, when UpdatePanel on a page is updated, other UpdatePanel on the page is also updated. Sometimes this is what you want, but most of you do not need every UpdatePanel update to respond to other UpdatePanel.
By setting the UpdateMode attribute of each UpdatePanel control on the page to Conditional, you can select the UpdatePanel instance to be updated and the Update time ). Then, when UpdatePanel updates and calls the server-side event handler, call UpdatePanel. Update on the other panel you want to Update. In this way, the server load can be reduced by reducing the number of rendered controls, and it also reduces the data volume in the response, because UpdatePanel without updating will not add any data to the response.

Do not use UpdatePanel update

AJAX not only creates a better user experience, but also provides more efficient network communication. When the traditional ASP. NET sending back occurs, all data in the Web form, including the view status, will be transmitted to the server in the sending back. The view status is an ASP. NET page, especially the ASP. NET page of The DataGrid and GridView control, which seems to be slow. Pages with too many view statuses will degrade performance, and pages with too many view statuses are too common in ASP. NET applications.

One of the advantages of replacing ASP. NET with AJAX callback is that it can be completed correctly. AJAX callback only transmits the data to be transmitted. This means that they do not have to include view states in the transmission.

When you use UpdatePanel to perform non-blinking updates on a page, you may think that you are building an efficient website. After all, UpdatePanel uses AJAX, isn't it? Unfortunately, if you check the communication in the network when UpdatePanel is updated, you will find that you have not saved anything at all, at least at the time of sending. View status data and other data that are usually transmitted to the server during sending back) will also be transmitted during the UpdatePanel callback. In fact, the growth in asynchronous XML-HTTP requests from UpdatePanel is almost the same as that in standard ASP. NET sending. The following are some secrets related to ASP. net ajax: Although UpdatePanel is easy to use, its communication efficiency is not high.

There is almost no way to improve the efficiency of UpdatePanel, but you can stop using UpdatePanel and switch to ASP. other functions of net ajax are used to update page content, which is not only the same but also more efficient. It only requires a little effort, but the final result is often considered worthwhile, because you can greatly reduce the amount of data transmitted between the client and the server.

You can also reduce the load on the server. When UpdatePanel calls back to the server, the page that is called back as the target will complete almost the entire lifecycle-the page will be instantiated and the controls on the page will also be instantiated, in addition, the control in UpdatePanel completes a normal rendering loop. This is a huge overhead for updating part of the web page.

For example, consider the page segment. It provides a simple UI that allows users to enter zip codes and click the button to initialize the city and state fields. All controls are carried in UpdatePanel. Therefore, the callback of the Button control is converted to an asynchronous callback, and the event handler (GetCityAndState) is called to the internal server of the callback. GetCityAndState does not show Code) read the zip code from the zip code text box, convert it to the city and state, and initialize the TextBox and DropDownList that indicate the City and State accordingly. Since all these occur within the UpdatePanel, the update is smooth and does not flash.

  1. Analysis on ASP. NET Web Security
  2. Session State of ASP. NET
  3. Analysis on the attribute ASP. NET of IsPostBack
  4. ASP. NET architecture and security mechanism
  5. Overview ASP. NET Crystal Reports

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.