Welcome Guest Search | Active Topics | Sign In | Register

Menu control with SiteMapDataSource and Roundedcorners style Options
SDDP
Posted: Tuesday, April 21, 2009 6:58:00 PM
Rank: Member
Groups: Member

Joined: 3/16/2009
Posts: 23
I added a menu control to the page and selected the rounded corners template in the designer. It looks perfect with the preselected items. But I need to have the menu get its items from the SiteMapDataSource control, like the ASP.Net menu does. When I set the property, the menu renders the menu items, but it doesn't look complete. The rounded corners and bottom of the submenus are not there. Does this style not work well with SiteMapDataSource control?

Here is the code, I tried removing everything in the TopGroup section (the menu items I don't want), but that didn't make any difference.

Code: HTML/ASPX
<eo:Menu ID="Menu2" runat="server" ControlSkinID="None" 
                            DataSourceID="SiteMapDataSource1" Width="200px">
                            <LookItems>
                                <eo:MenuItem Image-HoverUrl="00000306" Image-Mode="TextBackground" 
                                    Image-Url="00000300" ItemID="_TopLevelItem" LeftIcon-HoverUrl="00000304" 
                                    LeftIcon-Url="00000300" RightIcon-HoverUrl="00000305" RightIcon-Url="00000300">
                                    <SubMenu OffsetX="0" OffsetY="-6" ShadowDepth="0" 
                                        Style-CssText="font-size: 12px; cursor: hand; font-family: arial; background-color: #f7f7f7;">
                                    </SubMenu>
                                </eo:MenuItem>
                                <eo:MenuItem Height="23" 
                                    HoverStyle-CssText="background-color:#dddddd;border-left-color:#dfdfdf;border-left-style:solid;border-left-width:1px;border-right-color:#dfdfdf;border-right-style:solid;border-right-width:1px;color:#C00000;" 
                                    ItemID="_Default" 
                                    NormalStyle-CssText="border-right: #dfdfdf 1px solid; border-left: #dfdfdf 1px solid; color: #333333" 
                                    Text-Padding-Left="7" Text-Padding-Right="20">
                                </eo:MenuItem>
                                <eo:MenuItem Image-Mode="TextBackground" Image-Url="00000314" 
                                    ItemID="separator" LeftIcon-Url="00000313" RightIcon-Url="00000315">
                                </eo:MenuItem>
                                <eo:MenuItem Image-Mode="TextBackground" Image-Url="00000312" 
                                    ItemID="submenu_bottom" LeftIcon-Url="00000310" RightIcon-Url="00000311">
                                </eo:MenuItem>
                                <eo:MenuItem Image-Mode="TextBackground" Image-Url="00000307" 
                                    ItemID="submenu_top" LeftIcon-Url="00000308" RightIcon-Url="00000309">
                                </eo:MenuItem>
                            </LookItems>
                            <TopGroup ItemSpacing="1" 
                                Style-CssText="border-left-width: 1px; font-size: 12px; border-left-color: #e0e0e0; background-image: url(00000300); padding-bottom: 0px; cursor: hand; color: #555555; padding-top: 0px; font-family: arial">
                                <Items>
                                    <eo:MenuItem Image-Url="00000301" LookID="None" Text-Html="(">
                                    </eo:MenuItem>
                                    <eo:MenuItem LookID="None" Text-Html="HOME" Text-Padding-Right="6">
                                    </eo:MenuItem>
                                    <eo:MenuItem Image-Url="00000303" LookID="None" Text-Html="|">
                                    </eo:MenuItem>
                                    <eo:MenuItem Text-Html="SOLUTIONS">
                                        <SubMenu>
                                            <Items>
                                                <eo:MenuItem ItemID="top_border" LookID="submenu_top" Text-Html="">
                                                </eo:MenuItem>
                                                <eo:MenuItem Text-Html="Education">
                                                </eo:MenuItem>
                                                <eo:MenuItem Text-Html="Financial Services">
                                                </eo:MenuItem>
                                                <eo:MenuItem Text-Html="Government">
                                                </eo:MenuItem>
                                                <eo:MenuItem Text-Html="Manufacturing">
                                                </eo:MenuItem>
                                                <eo:MenuItem Text-Html="Telecommunications">
                                                </eo:MenuItem>
                                                <eo:MenuItem ItemID="separator" LookID="separator" Text-Html="">
                                                </eo:MenuItem>
                                                <eo:MenuItem Text-Html="Training and eLearning">
                                                </eo:MenuItem>
                                                <eo:MenuItem Text-Html="Video and Audio">
                                                </eo:MenuItem>
                                                <eo:MenuItem Text-Html="Web Conferencing">
                                                </eo:MenuItem>
                                                <eo:MenuItem Text-Html="Web Publishing">
                                                </eo:MenuItem>
                                                <eo:MenuItem ItemID="bottom_border" LookID="submenu_bottom" Text-Html="">
                                                </eo:MenuItem>
                                            </Items>
                                        </SubMenu>
                                    </eo:MenuItem>
                                    <eo:MenuItem Image-Url="00000303" LookID="None" Text-Html="|">
                                    </eo:MenuItem>
                                    <eo:MenuItem Text-Html="DOWNLOADS">
                                        <SubMenu>
                                            <Items>
                                                <eo:MenuItem ItemID="top_border" LookID="submenu_top" Text-Html="">
                                                </eo:MenuItem>
                                                <eo:MenuItem Text-Html="Download Home">
                                                </eo:MenuItem>
                                                <eo:MenuItem Text-Html="Trial Downloads">
                                                </eo:MenuItem>
                                                <eo:MenuItem Text-Html="Upgrades">
                                                </eo:MenuItem>
                                                <eo:MenuItem Text-Html="Platinum Package">
                                                </eo:MenuItem>
                                                <eo:MenuItem ItemID="bottom_border" LookID="submenu_bottom" Text-Html="">
                                                </eo:MenuItem>
                                            </Items>
                                        </SubMenu>
                                    </eo:MenuItem>
                                    <eo:MenuItem Image-Url="00000303" LookID="None" Text-Html="|">
                                    </eo:MenuItem>
                                    <eo:MenuItem Text-Html="SUPPORT">
                                        <SubMenu>
                                            <Items>
                                                <eo:MenuItem ItemID="top_border" LookID="submenu_top" Text-Html="">
                                                </eo:MenuItem>
                                                <eo:MenuItem Text-Html="Support Home">
                                                </eo:MenuItem>
                                                <eo:MenuItem Text-Html="Customer Service">
                                                </eo:MenuItem>
                                                <eo:MenuItem Text-Html="Documentations">
                                                </eo:MenuItem>
                                                <eo:MenuItem Text-Html="Training">
                                                </eo:MenuItem>
                                                <eo:MenuItem ItemID="bottom_border" LookID="submenu_bottom" Text-Html="">
                                                </eo:MenuItem>
                                            </Items>
                                        </SubMenu>
                                    </eo:MenuItem>
                                    <eo:MenuItem Image-Url="00000303" LookID="None" Text-Html="|">
                                    </eo:MenuItem>
                                    <eo:MenuItem Text-Html="COMPANY">
                                        <SubMenu>
                                            <Items>
                                                <eo:MenuItem ItemID="top_border" LookID="submenu_top" Text-Html="">
                                                </eo:MenuItem>
                                                <eo:MenuItem Text-Html="Support Home">
                                                </eo:MenuItem>
                                                <eo:MenuItem Text-Html="Training">
                                                </eo:MenuItem>
                                                <eo:MenuItem Text-Html="Documentation">
                                                </eo:MenuItem>
                                                <eo:MenuItem Text-Html="Forums">
                                                </eo:MenuItem>
                                                <eo:MenuItem ItemID="bottom_border" LookID="submenu_bottom" Text-Html="">
                                                </eo:MenuItem>
                                            </Items>
                                        </SubMenu>
                                    </eo:MenuItem>
                                    <eo:MenuItem Image-Url="Blank" LookID="None" Text-Html="-" Width="50">
                                    </eo:MenuItem>
                                    <eo:MenuItem Image-Url="00000302" LookID="None" Text-Html=")">
                                    </eo:MenuItem>
                                </Items>
                            </TopGroup>
                        </eo:Menu>


Thanks
eo_support
Posted: Tuesday, April 21, 2009 7:49:31 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

The first item and the last item in the rounded corners template are special. They use images to create the "round corners". When you populate from your site map, or any other data source, it wipes out all existing menu items, including these special ones, so you lose the round corner effect.

To resolve this issue, you can put those items back by code. The code should be something like this:

Code: C#
//Populate the menu from your data source
Menu1.DataBind();

//Create the first menu item
EO.Web.MenuItem item = new EO.Web.MenuItem("(");
item.LookID = "None";
item.Image.Url = "00000301";
Menu1.Items.Insert(0, item);

//Create the last menu item
item = new EO.Web.MenuItem(")");
item.LookID = "None";
item.Image.Url = "00000302";
Menu1.Items.Add(item);


If you compare the code with the .aspx source, you will see it duplicates the exact same contents in your .aspx file. For example, the first menu item in your .aspx file uses image "00000301", so the code set Image.Url to "00000301".

The above code only shows how to create additional items for the top menu bar. You will need to do the same for each sub menu.

Another way is to create additional dummy entry in your site map file directoy. For example, if you only have three top level items, you would have five top level entries in your site map, with the first and last used to create these two special items. These two items use different image files. So you will need to specify the image in your site map file as well. You can then use DataBinding object to map the image attribute to the Image.Url property. You can find more information here:

http://doc.essentialobjects.com/library/1/menucommon/databinding/populate_datasource.aspx

Check "Mapping data source attribute to item's property" section. The benefit of this approach is that no code is needed.

Thanks!
SDDP
Posted: Tuesday, April 21, 2009 8:56:31 PM
Rank: Member
Groups: Member

Joined: 3/16/2009
Posts: 23
Thanks for the response. I don't really want to have either the code or the extra stuff in the sitemap file. I was hoping this would work as is. Is there a template that does work well with the SiteMapDataSource?

I tried to use the MSDN template, but the designer won't apply anything to the menu control.
eo_support
Posted: Tuesday, April 21, 2009 9:25:41 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

The MSDN menu does work. The designer would set the menu's ControlSkinID property. That's enough to carry over all style settings. If you wish it to work the same way as other template, hold down shift key while clicking the "Create from Template" button (make sure you hold shift key until it switches away from the template tab).

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.