65.9K
CodeProject is changing. Read more.
Home

Making the entire menu td clickable

starIconstarIconstarIconstarIconstarIcon

5.00/5 (5 votes)

Jul 14, 2010

CPOL
viewsIcon

18561

By default, the asp:Menu generates menu items as hyperlinks. A user can navigate to a page by clicking on the text of the hyperlink. The text will not occupy the entire place for the td hence some part of the menu would not allow you to navigate to the required page. To make the entire menu area clickable and allow user to navigate to required page on click over the menu item, this trick can be used. You need to apply the following CSS to StaticMenuItemStyle property of asp:Menu item.
<StaticMenuItemStyle CssClass="StaticMenuHeader" />
.StaticMenuHeader td a
{
    display:block;
    width:100%;
}
This CSS actually makes the width of the internal hyperlink to 100% making the entire area clickable.