ASP Menu Control - Weird Spacing Issue

C

chris.mcinnes

G'day,

I'm trying to implement a graphical horizontal Menu-bar feeding off a
SiteMapDataSource with some top-level menu-items and a couple of
sub-menus.

I've managed to get the menu bar working, but noticed that the
top-level items were spaced generously.

Once the menu renders on the screen I find all these "margin-left=16px"
commands sitting within the anchor class, ie:

<a class="ctl00_Menu1_1 ctl00_Menu1_3" href="/page1.aspx"
style="margin-left:16px;">

Any ideas would be most appreciated. Below is the code I have used to
generate the menu.

Also, before anybody jumps back with a reply, modifying the
"DynamicHorizontalOffset" property didnt work.

Thanks!

Chris

----------------------------------------------------------------------------------

<asp:Menu ID="TopMenu" runat="server" DataSourceID="TopMenuDS"
DynamicMenuStyle-HorizontalPadding="0"
DynamicMenuItemStyle-HorizontalPadding="0"
StaticMenuStyle-HorizontalPadding="0"
StaticMenuItemStyle-HorizontalPadding="0" Orientation="Horizontal"
staticdisplaylevels="2" Width="933px">

<DataBindings>
<asp:MenuItemBinding DataMember="SiteMapNode"
ImageUrlField="Description" NavigateUrlField="Url"
PopOutImageUrl="images/MasterPages/Menu/PopOut.jpg" />
</DataBindings>

<StaticMenuStyle HorizontalPadding="0px" />
<StaticMenuItemStyle HorizontalPadding="0px" />
<DynamicMenuStyle HorizontalPadding="0px" />
<DynamicMenuItemStyle HorizontalPadding="0px" />

</asp:Menu>

----------------------------------------------------------------------------------
 
Joined
Aug 29, 2007
Messages
1
Reaction score
0
About the ASP.NET menu default 16 pixel text indent

The ASP.NET menu control creates a default 16px indent (margin-left:16px;) on static menuitems. This default value can be overwritten by using the StaticSubMenuIndent attribute:

StaticSubMenuIndent = "0px"


// Lars Brandt MCP/C#
 
Joined
May 26, 2008
Messages
2
Reaction score
0
Try changing the horizontal padding attribute of StaticMenuStyle
to represent half of the distance between menu items.

<StaticMenuStyle HorizontalPadding="5px" />
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top