I've tied myself in knots trying to fingure this out, and I'm begininng to think I'm not asking the correct quesiton (or doing decent google searchs). In a nut shell I'm trying to set the active tab on a menu while on a different page. Here's the best
simple example I could come up with.
1.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1"
StaticDisplayLevels="1" Orientation="Horizontal"
StaticHoverStyle-BackColor="#FFCCFF" StaticSelectedStyle-BackColor="#66FFFF"
MaximumDynamicDisplayLevels="0">
<StaticHoverStyle BackColor="#FFCCFF" />
<StaticMenuItemStyle BackColor="Silver" />
<StaticSelectedStyle BorderColor="#FFFFCC" BackColor="#66FFFF" />
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server"
ShowStartingNode="False" />
</div>
</form>
</body>
</html>
WebSitemap
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="" title="" description="">
<siteMapNode url="1.aspx" title="Page 1" description="">
<siteMapNode url="A.aspx" title="Page A" description="" />
</siteMapNode>
<siteMapNode url="2" title="Page 2" description="" />
</siteMapNode>
</siteMap>
Asume that A.aspx has the same code as 1.aspx. What would I change if I wanted the "Page 1" tab to be selected when I was on page A.
Thanks for the help, you all are always awsom!
I am not sure about your problem. I suppose you probability want to show the A.aspx when you select the 1.aspx. If so, you just need to modify the MaximumDynamicDisplayLevels property. You can delete it or you can set its value with “3”. Then you will see
what you want. You can refer to the below code about the menu control.
gardenerhand...
Member
7 Points
20 Posts
Can one set a menu item for a page that you are not on (while using a sitemap)?
Feb 29, 2012 02:21 AM|LINK
Hello All,
I've tied myself in knots trying to fingure this out, and I'm begininng to think I'm not asking the correct quesiton (or doing decent google searchs). In a nut shell I'm trying to set the active tab on a menu while on a different page. Here's the best simple example I could come up with.
1.aspx
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1" StaticDisplayLevels="1" Orientation="Horizontal" StaticHoverStyle-BackColor="#FFCCFF" StaticSelectedStyle-BackColor="#66FFFF" MaximumDynamicDisplayLevels="0"> <StaticHoverStyle BackColor="#FFCCFF" /> <StaticMenuItemStyle BackColor="Silver" /> <StaticSelectedStyle BorderColor="#FFFFCC" BackColor="#66FFFF" /> </asp:Menu> <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="False" /> </div> </form> </body> </html> WebSitemap <?xml version="1.0" encoding="utf-8" ?> <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" > <siteMapNode url="" title="" description=""> <siteMapNode url="1.aspx" title="Page 1" description=""> <siteMapNode url="A.aspx" title="Page A" description="" /> </siteMapNode> <siteMapNode url="2" title="Page 2" description="" /> </siteMapNode> </siteMap> Asume that A.aspx has the same code as 1.aspx. What would I change if I wanted the "Page 1" tab to be selected when I was on page A. Thanks for the help, you all are always awsom!Qi Wu - MSFT
Contributor
5794 Points
677 Posts
Re: Can one set a menu item for a page that you are not on (while using a sitemap)?
Mar 02, 2012 05:02 AM|LINK
Hi,
I am not sure about your problem. I suppose you probability want to show the A.aspx when you select the 1.aspx. If so, you just need to modify the MaximumDynamicDisplayLevels property. You can delete it or you can set its value with “3”. Then you will see what you want. You can refer to the below code about the menu control.
<asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1" StaticDisplayLevels="1" Orientation="Horizontal" StaticHoverStyle-BackColor="#FFCCFF" StaticSelectedStyle-BackColor="#66FFFF" MaximumDynamicDisplayLevels="3"> <StaticHoverStyle BackColor="#FFCCFF" /> <StaticMenuItemStyle BackColor="Silver" /> <StaticSelectedStyle BorderColor="#FFFFCC" BackColor="#66FFFF" /> </asp:Menu>If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework