导航控件

Web.sitemap for SiteMapPath

<?xml version="1.0" encoding="utf-8"?>

<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">

    <siteMapNode title="主页" description="" url="Default.aspx">

       <siteMapNode title="栏目" description="" url="Default2.aspx">

           <siteMapNode title="子栏目1" url="~/accp.aspx" description="" />

           <siteMapNode title="子栏目2" url="~/betest.aspx" description="" />

           <siteMapNode title="子栏目3" url="benet.aspx" description="" />

       </siteMapNode>

    </siteMapNode>

</siteMap>

Aspx文件Exp

<asp:SiteMapPath ID="smpShow" runat="server" PathSeparator=" : " Font-Names="Verdana" Font-Size="0.8em">

            <PathSeparatorStyle Font-Bold="True" ForeColor="#5D7B9D" />

            <CurrentNodeStyle ForeColor="#333333" />

            <NodeStyle Font-Bold="True" ForeColor="#7C6F57" />

            <RootNodeStyle Font-Bold="True" ForeColor="#5D7B9D" />

</asp:SiteMapPath>

 

 

Web.xml for TreeView

<?xml version="1.0" encoding="utf-8"?>

<Node title="主页" description="" url="Default.aspx">

       <siteMapNode title="栏目" description="" url="Default2.aspx">

           <siteMapNode title="子栏目1" url="~/accp.aspx" description="" />

           <siteMapNode title="子栏目2" url="~/betest.aspx" description="" />

           <siteMapNode title="子栏目3" url="benet.aspx" description="" />

       </siteMapNode>

    </Node>

Aspx文件Exp

<!-- DataSourceID指定XML文件数据源-->

<asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1"

            ImageSet="XPFileExplorer" NodeIndent="15">

            <ParentNodeStyle Font-Bold="False" />

            <HoverNodeStyle Font-Underline="True" ForeColor="#6666AA" />

            <SelectedNodeStyle BackColor="#B5B5B5" Font-Underline="False" HorizontalPadding="0px" VerticalPadding="0px" />

            <NodeStyle Font-Names="Tahoma" Font-Size="8pt" ForeColor="Black" HorizontalPadding="2px" NodeSpacing="0px" VerticalPadding="2px" />

 </asp:TreeView>

<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />

Aspx文件Exp2

<asp:TreeView ID="TreeView1" runat="server" DataSourceID="XmlDataSource1">

            <DataBindings>

                <asp:TreeNodeBinding DataMember="siteMapNode" NavigateUrlField="url" TextField="title" />

            </DataBindings>

</asp:TreeView>

<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/App_Data/Web.xml"></asp:XmlDataSource>

 

Web.sitemap for Menu

<?xml version="1.0" encoding="utf-8"?>

<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">

    <siteMapNode title="主页" description="" url="Default.aspx">

       <siteMapNode title="栏目1" description="" url="Default2.aspx">

           <siteMapNode title="子栏目1" url="~/accp.aspx" description="" />

           <siteMapNode title="子栏目2" url="~/betest.aspx" description="" />

           <siteMapNode title="子栏目3" url="benet.aspx" description="" />

       </siteMapNode>

       <siteMapNode title="栏目2" description="" url="Company.aspx">

           <siteMapNode title="子栏目1" url="~/accp.aspx?accp" description="" />

           <siteMapNode title="子栏目2" url="~/betest.aspx?btest" description="" />

           <siteMapNode title="子栏目3" url="benet.aspx?benet" description="" />

       </siteMapNode>

    </siteMapNode>

</siteMap>

Aspx文件Exp

<asp:Menu ID="Menu1" runat="server" BackColor="#FFFBD6" DataSourceID="SiteMapDataSource1"

            DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#990000"

            Orientation="Horizontal" StaticSubMenuIndent="10px">

            <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />

            <DynamicHoverStyle BackColor="#990000" ForeColor="White" />

            <DynamicMenuStyle BackColor="#FFFBD6" />

            <StaticSelectedStyle BackColor="#FFCC66" />

            <DynamicSelectedStyle BackColor="#FFCC66" />

            <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />

            <StaticHoverStyle BackColor="#990000" ForeColor="White" />

            <StaticItemTemplate>

                <%# Eval("Text") %>

            </StaticItemTemplate>

</asp:Menu>

<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />

posted @ 2008-10-25 02:45  Edward Xie  阅读(157)  评论(0编辑  收藏  举报