TAILIEUCHUNG - ASP.NET 4 Unleased - p 176

Khi làm việc với các UpdatePanel, bạn không bao giờ nên quên rằng phía máy chủ trang trải qua chu kỳ bình thường trang cuộc sống thực hiện nó bất cứ khi nào một postback không đồng bộ xảy ra. Nếu bạn thực hiện một cơ sở dữ liệu đắt tiền của bạn tra cứu trong Page_Load () phương pháp, đó là tra cứu xảy ra với mỗi cuộc gọi không đồng bộ với máy chủ của bạn. | 1724 CHAPTER 38 Using Server-Side AJAX NOTE To learn more about caching see Chapter 29 Caching Application Pages and Data. When working with the UpdatePanel you should never forget that the server-side page undergoes its normal page execution life cycle whenever an asynchronous postback occurs. If you perform an expensive database lookup in your Page_Load method that lookup occurs with each asynchronous call to your server. You can avoid performing unnecessary server-side work during an asynchronous postback by taking advantage of the ScriptManager control s IsInAsyncPostBack property. You can use this property to detect whether the page is executing in the context of a normal postback or an asynchronous postback. Using the Timer Control The AJAX Timer control enables you to refresh an UpdatePanel or the entire page on a timed basis. The Timer control has one important property Interval The amount of time in milliseconds between Tick events. The default value is 60 000 1 minute . The Timer control raises a Tick event every so many milliseconds depending on the value of its Interval property. If you don t associate the Timer control with an UpdatePanel the Timer posts the entire page back to the server performing a normal postback. For example the page in Listing posts the entire page back to the server every 2 seconds. LISTING @ Page Language C DOCTYPE html PUBLIC - W3C DTD XHTML Transitional EN http TR xhtml1 DTD html xmlns http 1999 xhtml head runat server title Timer Page title head body form id form1 runat server div asp ScriptManager ID ScriptManager1 runat server asp Timer ID Timer1 Interval 2000 runat server From the Library of Wow eBook Using the Timer Control 1725 The time is T div form body html A more typical use of the Timer control is to refresh an UpdatePanel control s content on a timed basis. For example the page in Listing .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.