Click here to Skip to main content
15,889,200 members
Articles / Web Development / ASP.NET
Tip/Trick

Making the entire menu td clickable

Rate me:
Please Sign up or sign in to vote.
5.00/5 (5 votes)
14 Jul 2010CPOL 18.3K   3   1
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.

C++
<StaticMenuItemStyle CssClass="StaticMenuHeader" />


CSS
.StaticMenuHeader td a
{
    display:block;
    width:100%;
}


This CSS actually makes the width of the internal hyperlink to 100% making the entire area clickable.

License

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


Written By
Technical Lead Kale Consultants Ltd.
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 5 Pin
Hornwood50910-Sep-13 8:27
Hornwood50910-Sep-13 8:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.