Click here to Skip to main content
15,939,828 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am using .net version 3.5.. here I am building dynamic menu where menu item are extracted from sql based table.. Now, i want a separator to differentiate menu items at root menu.. I have tried following code at c#

protected void menuBar_MenuItemDataBound(object sender, MenuEventArgs e)

        e.Item.SeparatorImageUrl = "~/Separator.gif";
        _lastMenuItem = e.Item;

    protected void menuBar_PreRender(object sender, EventArgs e)
        _lastMenuItem.SeparatorImageUrl = null;


At designer, the code is
<asp:Menu ID="menuBar" runat="server" Orientation="Horizontal" MaximumDynamicDisplayLevels="10"
                        CssClass="menuHeader"  DynamicHorizontalOffset="3"
                        DynamicVerticalOffset="7" OnMenuItemDataBound="menuBar_MenuItemDataBound" onprerender="menuBar_PreRender" >

I could not get the separator this way.. Any help??? Also I had tried StaticTopSeparatorImageUrl="~/Separator.gif" but this way in designer separator image was displayed but height was at most and no separator was displayed when i run the code.. any help for this as well???

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900