tailieunhanh - ASP.NET 4 Unleased - p 30

Các trang trong Ví dụ 5,20 chứa hai liên kết. Cả hai liên kết bao gồm một tham số chuỗi truy vấn tổng thể được đặt tên, đại diện cho tên của một trang Master. Khi bạn nhấp vào liên kết đầu tiên, các Master Trang tải (xem hình ) và khi bạn nhấp vào liên kết thứ hai | 264 CHAPTER 5 Designing Websites with Master Pages case Dynamic2 break MasterPageFile script asp Content ID Content1 ContentPlaceHolderID ContentPlaceHolder1 Runat Server Select a Master Page ul class selectMaster li a href master Dynamic1 Dynamic Master 1 a li li a href master Dynamic2 Dynamic Master 2 a li ul asp Content The page in Listing contains two links. Both links include a query string parameter named master which represents the name of a Master Page. When you click the first link the Master Page loads see Figure and when you click the second link the Master Page loads see Figure . The page in Listing includes a Page_PreInit event handler. This handler grabs the value of the master query string parameter and assigns the value of this parameter to a Profile property. Next the value of the Profile property is assigned to the page s MasterPageFile property. Assigning a value to the MasterPageFile property causes a Master Page to be dynamically loaded. From the Library of Wow eBook Loading Master Pages Dynamically 265 FIGURE Displaying the Dynamic1 Master Page. 5 FIGURE Displaying the Dynamic2 Master Page. From the Library of Wow eBook 266 CHAPTER 5 Designing Websites with Master Pages Because the name of the Master Page is assigned to a Profile property the selected Master Page loads for a user even if the user returns to the website many years in the future. The Profile object automatically persists the values of its properties for a user across multiple visits to a website. The Profile is defined in the web configuration file contained in Listing . LISTING xml version configuration profile properties add name MasterPageFile defaultValue properties profile configuration Loading Master Pages Dynamically for Multiple Content Pages In the .

TÀI LIỆU LIÊN QUAN
crossorigin="anonymous">
Đã 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.