[英]how to create a horizontal menu from web.sitemap in asp.net
i was trying to create horizontal site menu from web.site map.But unfortunately it is showing like first one root node, then three parent node then each child node correspondingly.But i want in the following structure like, first four main menu horizontally like Home > Services > Products > Company
then child menus of these parent menus should show below of each individuals like if i hover cursor over Services
it should show child menus Web Designs >Website Development
etc. or for Products it should show HTML Metatag Extractor ,Apartment Management System
etc.How can i do that.With the existing work it is showing like first single root node Home
,if you mouse hover it is showing Services , Products , Company then each child node correspondigly 我试图从web.site map创建水平站点菜单。但是不幸的是,它显示为第一个根节点,然后是三个父节点,然后分别是每个子节点。但是我想要以下结构,例如前四个主菜单Home > Services > Products > Company
然后这些父菜单的子菜单应显示在每个人的下方,例如,如果我将光标悬停在“ Services
,则应显示子菜单Web Designs >Website Development
等;对于产品,则应显示HTML Metatag Extractor ,Apartment Management System
等我该怎么做。在现有工作中,它像第一个单个根节点Home
一样显示,如果您将鼠标悬停在它上则显示Services,Products,Company,则每个子节点对应
Following is the work which i have done web.sitemap is 以下是我做过的工作web.sitemap是
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="index.aspx" title="Home" description="Home">
<siteMapNode url="Services.aspx" title="Services" description="">
<siteMapNode url="webdesign.aspx" title="Web Designs" description="" />
<siteMapNode url="websitedevelopment.aspx" title="Website Development" description=""/>
<siteMapNode url="cmscustomization.aspx" title="CMS Customization" description="" />
<siteMapNode url="softwaredevelopment.aspx" title="Software Development" description="" />
<siteMapNode url="internetmarketing.aspx" title="Internet Marketing" description="" />
<siteMapNode url="mobiledevelopment.aspx" title="Mobile Development" description="" />
<siteMapNode url="hostingsolutions.aspx" title="Hosting Solutions" description="" />
</siteMapNode>
<siteMapNode url="products.aspx" title="Products" description="" >
<siteMapNode url="tagxtor.aspx" title="HTML Metatag Extractor" description="" />
<siteMapNode url="ams.aspx" title="Apartment Management System" description="" />
<siteMapNode url="cgnp.aspx" title="Closed Group Network Portal" description="" />
<siteMapNode url="ribbon.aspx" title="Retail Management System" description="" />
</siteMapNode>
<siteMapNode url="company.aspx" title="Company" description="" >
<siteMapNode url="aboutus.aspx" title="About Us" description="" />
<siteMapNode url="team.aspx" title="Our Team" description="" />
<siteMapNode url="career.aspx" title="Work With Us" description="" />
<siteMapNode url="contactus.aspx" title="Contact Us" description="" />
</siteMapNode>
</siteMapNode>
</siteMap>
HTML code HTML代码
<asp:Menu ID="Menu1" runat="server" StaticEnableDefaultPopOutImage="false" Orientation="Horizontal" DataSourceID="SiteMapDataSource1">
<asp:SiteMapPath ID="SiteMapPath1" runat="server" PathSeparator=">"></asp:SiteMapPath>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
The way you currently have it set up, Home is the top node and Services, Products, and Company are below it. 当前设置方式中,“首页”是顶部节点,“服务”,“产品”和“公司”位于其下方。
You'll want to do something like this: 您将需要执行以下操作:
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="" title="Top Level" description="Top Level">
<siteMapNode url="Home.aspx" title="Home" description="" />
<siteMapNode url="Services.aspx" title="Services" description="" />
<siteMapNode url="Products.aspx" title="Products" description="" />
<siteMapNode url="Company.aspx" title="Company" description="" />
</siteMapNode>
</siteMap>
In your SiteMapDataSource you'll want to add some new properties 在您的SiteMapDataSource中,您需要添加一些新属性
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" StartingNodeOffset="0" ShowStartingNode="false" />
This change to the SiteMapDataSource will ignore the Top Level Node and show the 4 nodes underneath it. 对SiteMapDataSource的更改将忽略“顶级节点”,并显示其下的4个节点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.