SiteMap Controls: How to add a duplicate link in the web.sitemap
来源:互联网 发布:ssr客户端 for mac 编辑:程序博客网 时间:2024/05/17 04:28
One of the requirements for the sitemap provider is that you cannot have duplicate url attribute values in the web.sitemap. While this is understandable, it can be problematic but easily overcome.
Lets say you have a hierarchy like
<siteMap>
<siteMapNode url="" title="categorylvl1" >
<siteMapNode url="" title="categorylvl2" >
</siteMap>
right? so you have one Category (lvl1) that has a depth of 3, andy you have antoher that has a depth of 2. Now you only want to show 2 levels deep because you've designed your menu treeview such that the nodes are stacked up on eachother instead of arranged like a tree which really only provides enough for a 2 level display:
Category (no url attribute assigned)
Category (no url attribute assigned)
1. You should have a page for ALL categories regardless of if there is no official "content" for those categories. At the very least you should have some page with SOMETHING on it as (in my opinion) this breaks a fundamental rule of navigation and user expectation. That rule is, " if it's in the menu, they'll want to click on it".
2. If you find yourself in a tight spot like I did today with the same situation and of course the category levels were empty and I was stacking my hierarchy only 2 nodes deep which left me with non-clickable categories; the answer to is to put a querystring in the url for the "duplicate" url attribute.
<siteMap>
<siteMapNode url="" title="categorylvl1" >
<siteMapNode url="" title="categorylvl2" >
</siteMap>
You should be able to just add random characters at the end as they will most likely be ignored should you need to do this more than once for the same path. Even better would be to convince your client or boss that Rule #1 should be followed :)
Lets say you have a hierarchy like
<siteMap>
<siteMapNode url="" title="categorylvl1" >
<siteMapNode url="" title="categorylvl1a" >
<siteMapNode url="/path.aspx" title="categorylvl1b" />
<siteMapNode>
<siteMapNode><siteMapNode url="" title="categorylvl2" >
<siteMapNode url="/otherpath.aspx" title="categorylvl2a" />
<siteMapNode/></siteMap>
right? so you have one Category (lvl1) that has a depth of 3, andy you have antoher that has a depth of 2. Now you only want to show 2 levels deep because you've designed your menu treeview such that the nodes are stacked up on eachother instead of arranged like a tree which really only provides enough for a 2 level display:
Category (no url attribute assigned)
Link
CategoryLink
etc etc...but your display actually turns out to be something likeCategory (no url attribute assigned)
SubCategory (no url attribute assigned)
Category(3rd level node is not shown)
Link
And now you say to yourself, how in the hell do I put a duplicate path in the web.sitemap so I can have SubCategories go to the first (3rd level) link for that category? Well, the first thing that comes to mind is:1. You should have a page for ALL categories regardless of if there is no official "content" for those categories. At the very least you should have some page with SOMETHING on it as (in my opinion) this breaks a fundamental rule of navigation and user expectation. That rule is, " if it's in the menu, they'll want to click on it".
2. If you find yourself in a tight spot like I did today with the same situation and of course the category levels were empty and I was stacking my hierarchy only 2 nodes deep which left me with non-clickable categories; the answer to is to put a querystring in the url for the "duplicate" url attribute.
<siteMap>
<siteMapNode url="" title="categorylvl1" >
<siteMapNode url="/path.aspx?" title="categorylvl1a" >
<siteMapNode url="/path.aspx" title="categorylvl1b" />
<siteMapNode>
<siteMapNode><siteMapNode url="" title="categorylvl2" >
<siteMapNode url="/otherpath.aspx" title="categorylvl2a" />
<siteMapNode/></siteMap>
You should be able to just add random characters at the end as they will most likely be ignored should you need to do this more than once for the same path. Even better would be to convince your client or boss that Rule #1 should be followed :)
- SiteMap Controls: How to add a duplicate link in the web.sitemap
- How to add icons to a SiteMap Menu in ASP .NET
- ***.sitemap
- RadTreeView:How to add controls to a node
- Build a Search Engine SiteMap in C#
- How to find child controls that are located in the template of a parent control
- <add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap
- How to create a link in Linux
- 动态修改Web.sitemap
- 动态修改Web.sitemap
- How to initialize child controls in a derived CDialogBar
- How to initialize child controls in a derived CDialogBar
- SiteMap config vs. Web.config in page security right definition
- HOW TO: remove the 300ms delay when clicking on a link in JQuery Mobile
- 创建站点地图(web.sitemap)
- How To Add Menus to the Menubar in Cocoa
- How to add a DELAY in applying transactions in GoldenGate?
- MySQL How to add a column in a table?
- java中不同数据库连接字符串
- 给自己留下类库
- 用户管理
- unicode与char之间的转换
- 用const对象引用做形参
- SiteMap Controls: How to add a duplicate link in the web.sitemap
- Mobexa.OLLE.v1.0.5.XScale.WM2003
- 自定义滚动条
- Singleton 设计模式
- 分離數據庫造成全文索引的丟失
- 3GR.Technologies.MxCalc.SE.NET.v3.1.ARM.XScale.PPC
- [转贴]安全进程攻略—僵尸进程
- callback c
- C#.Net学习——对象