Welcome Guest Search | Active Topics | Sign In | Register

Build dynamic EOMenu with SiteMapDataSource Options
Johan
Posted: Friday, December 14, 2007 5:28:55 AM
Rank: Newbie
Groups: Member

Joined: 12/1/2007
Posts: 8
Hello,
I want to use the "RoundCorners" layout together with a .NET sitemap file. So I used the Menu Builder Tool selected the "Round Corners" layout and removed all "hard coded" entries. After that I copied the rest of the code into my web page, exported the pictures and bound the menu to the datasource. But that doen't work. I don't see the beginning and the end picture "(" ")" and some other pictures are missing, too.

How do I build the "Round Corners" template 1:1 dynamicly by using a .Net Sitemap? A small general example would help very much.

Thanks you for any help.
Johan

Some "non finished code" to show what I have done.

Quote:

=== ASP ===

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

<eo:Menu ID="MainNavigationJSMenu" runat="server"
ControlSkinID="None" Width="200px" AutoSelectSource="NavigateUrl" AutoSelectTarget="Path">
<LookItems>
<eo:MenuItem ItemID="_TopGroup"></eo:MenuItem>
<eo:MenuItem LeftIcon-Url="../files/pictures/system/00000300.gif" LeftIcon-HoverUrl="../files/pictures/system/00000304.gif"
RightIcon-Url="../files/pictures/system/00000300.gif" RightIcon-HoverUrl="../files/pictures/system/00000305.gif"
Image-Mode="TextBackground" Image-Url="../files/pictures/system/00000300.gif" Image-HoverUrl="../files/pictures/system/00000306.gif" ItemID="_TopLevelItem">
<SubMenu OffsetX="0" OffsetY="-6" ShadowDepth="0" Style-CssClass="topMenu1"></SubMenu>
</eo:MenuItem>
<eo:MenuItem IsSeparator="True" ItemID="_Separator"></eo:MenuItem>
<eo:MenuItem Text-Padding-Left="7" Text-Padding-Right="20" Height="23" NormalStyle-CssClass="topMenu2" HoverStyle-CssClass="topMenu3" ItemID="_Default"></eo:MenuItem>
<eo:MenuItem LeftIcon-Url="../files/pictures/system/00000313.gif" RightIcon-Url="../files/pictures/system/00000315.gif" Image-Mode="TextBackground" Image-Url="../files/pictures/system/00000314.gif" ItemID="separator"></eo:MenuItem>
<eo:MenuItem LeftIcon-Url="../files/pictures/system/00000310.gif" RightIcon-Url="../files/pictures/system/00000311.gif" Image-Mode="TextBackground" Image-Url="../files/pictures/system/00000312.gif" ItemID="submenu_bottom"></eo:MenuItem>
<eo:MenuItem LeftIcon-Url="../files/pictures/system/00000308.gif" RightIcon-Url="../files/pictures/system/00000309.gif" Image-Mode="TextBackground" Image-Url="../files/pictures/system/00000307.gif" ItemID="submenu_top"></eo:MenuItem>
</LookItems>

<TopGroup ItemSpacing="1" Style-CssClass="topMenu4">
<Items>
<eo:MenuItem Image-Url="../files/pictures/system/00000301.gif" Text-Html="(" LookID="None"></eo:MenuItem>
<eo:MenuItem Image-Url="../files/pictures/system/00000302.gif" Text-Html=")" LookID="None"></eo:MenuItem>
</Items>
</TopGroup>

<DesignOptions ApplicationRoot="D:\Dev\Test\WebSite\Home"></DesignOptions>
</eo:Menu>


=== C# ===

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// Assign DataSource to menu
MainNavigationJSMenu.DataSource = SMP_files_MainNavigationJS;
MainNavigationJSMenu.DataBind();

MainNavigationJSMenu.CssFile = SCUtil.GetFullWebPath(Request.ApplicationPath, "~/files/eomenu.css");
}
}

=== Web.sitemap ===

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~/web/Default.aspx" title="Root" description="Root" visible="false" lookid="" activePage="" >
<siteMapNode url="~/web/Home.aspx" title="Home" description="Home" visible="true" lookid="" activePage="" >
<siteMapNode url="~/web/Page1.aspx" title="H-Page1" description="Home P1" visible="true" lookid="" activePage="" />
<siteMapNode url="~/web/Page2.aspx" title="H-Page2" description="Home P2" visible="true" lookid="" activePage="" />
<siteMapNode url="~/web/Page3.aspx" title="H-Page3" description="Home P3" visible="true" lookid="" activePage="" />
</siteMapNode>
<siteMapNode url="~/forum/forum.aspx" title="Forum" description="Forum" visible="true" lookid="" activePage="" />
<siteMapNode url="~/download/Download.aspx" title="Download" description="Download" visible="true" lookid="" activePage="" >
<siteMapNode url="~/download/Page1.aspx" title="D-Page1" description="Download P1" visible="true" lookid="" activePage="" />
<siteMapNode url="~/download/Page2.aspx" title="D-Page2" description="Download P2" visible="true" lookid="" activePage="" />
<siteMapNode url="~/download/Page3.aspx" title="D-Page3" description="Download P3" visible="true" lookid="" activePage="" >
<siteMapNode url="~/download/Page4.aspx" title="D-Page4" description="Download P4" visible="true" lookid="" activePage="" />
<siteMapNode url="~/download/Page5.aspx" title="D-Page5" description="Download P5" visible="true" lookid="" activePage="" >
<siteMapNode url="~/download/Page6.aspx" title="D-Page6" description="Download P6" visible="true" lookid="" activePage="" />
</siteMapNode>
</siteMapNode>
</siteMapNode>
<siteMapNode url="~/shop/Default.aspx" title="Shop" description="Shop" visible="true" lookid="" activePage="" />
</siteMapNode>
</siteMap>

eo_support
Posted: Friday, December 14, 2007 5:37:41 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Hi Johan,

It won't work that way because the first item and the last item, which renders ( and ), are different. So for example, if you have 3 top level items in your site map, the menu needs to have 5 top level menu items.

The easiest way is to add two dummy nodes into your site map file, that way you at least get 5 items. You will then handle the menu's ItemDataBound event, inside that event handler you can check Menu1.DataItem to determine whether the current item is a dummy item, if it is, you will then use code to change the newly created menu item's property, for example, to change its background image so that it renders "(". Check the .ASPX source generated by Menu Builder to find out what property you need to set.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.