Cấp bậc tác giả:

DOTNET

Hướng dẫn sử dụng điều khiển SiteMapPath trong Asp.net

Được viết bởi webmaster ngày 30/01/2020 lúc 10:25 AM
SiteMapPath có thể hiển thị thông tin về cấu trúc website là nhờ một tập tin XML tên là Web.sitemap, một tập tin mô tả cấu trúc website.
  • 0
  • 5129

Hướng dẫn sử dụng điều khiển SiteMapPath trong Asp.net

SiteMapPath có thể hiển thị thông tin về cấu trúc website là nhờ một tập tin XML tên là Web.sitemap, một tập tin mô tả cấu trúc website.

Tại trang aspx:
<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Hướng dẫn cách sử dụng điều khiển SiteMapPath trong asp.net</title>
</head>
<body style="padding:25px">
    <form id="form1" runat="server">
    <div>
        <h2 style="color:MidnightBlue; font-style:italic;">      
            Cách sử dụng SiteMapPath
        </h2>      
        <hr width="450" align="left" color="Gainsboro" />
        <asp:SiteMapDataSource 
            ID="SiteMapDataSource1" 
            runat="server"
            />
        <asp:SiteMapPath 
            ID="SiteMapPath1" 
            runat="server"
            Font-Bold="true"
            Font-Names="Lucida Sans Unicode"
            Font-Size="Large"
            BackColor="Azure"
            >
        </asp:SiteMapPath>
        <br /><br />
        <asp:Image 
            ID="Image1" 
            runat="server" 
            ImageUrl="~/Images/SeaBeach.jpg"
            Height="300"
            />
    </div>
    </form>
</body>
</html>

Tại Web.sitemap
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
  <siteMapNode 
    url="Default" 
    title="Home" 
    description="Home Page"
    >
    <siteMapNode 
      url="StandardToolBox" 
      title="Standard ToolBox Control" 
      description="Standard ToolBox Control"
      >
      <siteMapNode 
        url="BulletedList" 
        title="BulltedList Example"
        description="BulltedList Control Simple Example"
        />
      <siteMapNode
        url="CheckBox" 
        title="CheckBox Example"
        description="CheckBox Control Simple Example"
        />
      <siteMapNode 
        url="CheckBoxList" 
        title="CheckBoxList Example" 
        description="CheckBoxList Control Simple Example"
        />
      <siteMapNode 
        url="Image" 
        title="Image Control Example" 
        description="Image Control Simple Example"
        />
    </siteMapNode>
    <siteMapNode 
      url="DataToolBox" 
      title="Data ToolBox Control"
      description="Data ToolBox Control"
      >
      <siteMapNode 
        url="SqlDataSource" 
        title="SqlDataSource Example" 
        description="SqlDataSource Simple Example"
        />
      <siteMapNode 
        url="XmlDataSource" 
        title="XmlDataSource Example" 
        description="XmlDataSource Simple Example"
        />
    </siteMapNode>
  </siteMapNode>
</siteMap>

Trang web sẽ trông như sau:
SiteMapPath.png

Nguồn bài viết: DOTNET.VN

BÌNH LUẬN BÀI VIẾT

Bài viết mới nhất

LIKE BOX

Bài viết được xem nhiều nhất

HỌC HTML