Đang chuẩn bị liên kết để tải về tài liệu:
ASP.NET 4 Unleased - p 113

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

ằng cách lợi dụng của Sơ đồ và SiteMapNode các lớp học, bạn có thể làm việc trực tiếp với trang web bản đồ trong một trang. Ví dụ, hãy tưởng tượng rằng bạn muốn hiển thị giá trị của thuộc tính tiêu đề SiteMapNode trên thanh tiêu đề của cả hai trình duyệt và trong cơ thể của trang. | 1094 CHAPTER 23 Using Site Maps IsAccessibleToUser Returns True when the current user has permissions to view the current node. IsDescendantOf Returns True when the current node is a descendant of a particular node. By taking advantage of the SiteMap and SiteMapNode classes you can work directly with Site Maps in a page. For example imagine that you want to display the value of the SiteMapNode title attribute in both the browser s title bar and in the body of the page. Listing 23.7 demonstrates how you can retrieve the value of the Title property associated with the current page programmatically. LISTING 23.7 Products FirstProduct.aspx @ Page Language C DOCTYPE html PUBLIC - W3C DTD XHTML 1.1 EN http www.w3.org TR xhtml11 DTD xhtml11.dtd script runat server void Page_Load if Page.IsPostBack SiteMapNode currentNode SiteMap.CurrentNode this.Title currentNode.Title ItlBodyTitle.Text currentNode.Title lblDescription.Text currentNode.Description script html xmlns http www.w3.org 1999 xhtml head id Head1 runat server title First Product title head body form id form1 runat server div h1 asp Literal ID ltlBodyTitle runat server h1 asp Label id lblDescription Runat server From the Library of Wow eBook Advanced Site Map Configuration 1095 div form body html When you open the page in Listing 23.7 the Page_Load event handler grabs the current SiteMapNode and modifies the Page Title property. The handler also assigns the value of the Title property to a Literal control contained in the body of the page. Finally the value of the SiteMapNode s Description property is assigned to a Label control see Figure 23.5 . 23 FIGURE 23.5 Retrieving Site Map node properties. NOTE It would make sense to place the code in Listing 23.7 in a Master Page. To learn more about Master Pages see Chapter 5 Designing Websites with Master Pages. Advanced Site Map Configuration This section explores several advanced features of Site Maps. For example you learn how to display different SiteMap nodes .

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.