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

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

Bất cứ tùy chỉnh thuộc tính mà bạn thêm vào một đồ trang web tiếp xúc của trường của lớp SiteMapNode. Ví dụ, các trang trong Ví dụ 23,15 lấy giá trị của thuộc tính metaDescription từ nút hiện tại và hiển thị các giá trị trong một tag thực tế. | 1104 CHAPTER 23 Using Site Maps siteMapNode siteMapNode siteMap Any custom attributes that you add to a Site Map are exposed by instances of the SiteMapNode class. For example the page in Listing 23.15 retrieves the value of the metaDescription attribute from the current node and displays the value in an actual meta tag. LISTING 23.15 Services FirstService.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 HtmlMeta meta new HtmlMeta meta.Name Description meta.Content SiteMap.CurrentNode metaDescription head1.Controls.Add meta script html xmlns http www.w3.org 1999 xhtml head id head1 runat server title First Service title head body form id form1 runat server div h1 The First Service h1 div form body html From the Library of Wow eBook Creating Custom Site Map Providers 1105 After you open the page in Listing 23.15 in a web browser you can select View Source to see the meta tag added to the source of the page see Figure 23.7 . FIGURE 23.7 Extending a Site Map with a meta tag. 23 It is important to emphasize that you can do anything you want with custom SiteMapNode attributes. You can represent page titles section titles product icons or anything else with a custom attribute. Creating Custom Site Map Providers Site Maps use the provider model. This means that you can easily modify or extend the way Site Maps work by creating your own Site Map provider. In this section we create two custom Site Map providers. First we create the AutoSiteMapProvider. This provider automatically builds a Site Map based on the file and folder structure of a website. Next we create a SqlSiteMapProvider. This provider enables you to store a Site Map in a Microsoft SQL Server database table instead of an XML file. From the Library of Wow eBook 1106 CHAPTER 23 Using Site Maps Creating the AutoSiteMapProvider All Site Map providers inherit from the base SiteMapProvider class. If you want to create your

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.