Asp.Net 2.0 does not have a built in Tab Structure; we can implement this with some 3rd party controls, but to do so we need to undergo the additional hassle of integrating with the 3rd party assemblies and at time we end up in scenarios where the hosting/production environment does not allow hosting of 3rd party assemblies, or there could be privilege issues in deploying 3rd party assemblies to the hosting/production environment. So what do we do? We still need to have the Tab Structure right!! Here is the work around, we can use the
Let us now see, how to get a Tab Structure in Asp.Net 2.0 using the built in Asp:Menu
Create a new Asp.Net Project and create a page where we need to implement the Tab Structure.
Add an Asp:Menu
The style attributes StaticMenuStyle & StaticSelectedStyle refer to the style sheets defined in the .css file below
.MenuNormal
{
background-color:Silver;
color:Blue;
font-family:Verdana;
font-size:15px;
border-style:solid;
border-color:Black;
border-width:1px;
}
.MenuActive
{
background-color:Maroon;
color:White;
font-family:Verdana;
font-size:15px;
border-style:solid;
border-color:Black;
border-width:1px;
}
The Selected Tab can be identified by implementing the MenuItemClick event as follows
protected void mnuMain_MenuItemClick(object sender, MenuEventArgs e)
{
lblMsg.Text = "You have selected the Tab: " + e.Item.Value;
}
No comments:
Post a Comment