Part 154 Using styles with asp net menu control

preview_player
Показать описание
Text version of the video

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.

Slides

All ASP .NET Text Articles

All ASP .NET Slides

ASP.NET Playlist

All Dot Net and SQL Server Tutorials in English

All Dot Net and SQL Server Tutorials in Arabic

To configure styles for the statically displayed portion of the menu, use
StaticMenuStyle - Applicable for the entire statically displayed portion of the menu
StaticMenuItemStyle - Applicable for the individual menu items in the statically displayed portion of the menu
StaticSelectedStyle - Applicable for the selected menu item in the statically displayed portion of the menu
StaticHoverStyle - Applicable for the statically displayed menu item over which mouse is hovered over

To configure styles for the dynamically displayed portion of the menu, use
DynamicMenuStyle - Applicable for the entire dynamically displayed portion of the menu
DynamicMenuItemStyle - Applicable for the individual menu items in the dynamically displayed portion of the menu
DynamicSelectedStyle - Applicable for the selected menu item in the dynamically displayed portion of the menu
DynamicHoverStyle - Applicable for the dynamically displayed menu item over which mouse is hovered over

To configure styles for each level in the menu control, use
LevelMenuItemStyles - If the menu control has 2 levels, you will have the html as shown below. MenuLevel1 css class will be applied for menu items at level 1. Along the same lines MenuLevel2 css class will be applied for menu items at level 2.

LevelSelectedStyles - If the menu control has 2 levels, you will have the html as shown below. Yellow color will be applied for the menu item selected at level 1. Maroon color will be applied for menu item selected at level 2.

If you are following along with the example in the demo, for LevelSelectedStyles, StaticSelectedStyle and DynamicSelectedStyle to work, you need the following code in Page_Load of the master page.
protected void Page_Load(object sender, EventArgs e)
{
foreach (MenuItem item in Menu1.Items)
{
Check(item);
}
}

private void Check(MenuItem item)
{
if (item.NavigateUrl.Equals(Request.AppRelativeCurrentExecutionFilePath, StringComparison.InvariantCultureIgnoreCase))
{
item.Selected = true;
}
else if (item.ChildItems.Count ] 0)
{
foreach (MenuItem menuItem in item.ChildItems)
{
Check(menuItem);
}
}
}
Рекомендации по теме
Комментарии
Автор

Sure, will do it soon. In the description of this video, I have included the link for ASP .NET, C#, and SQL Server playlists. All the videos are arranged in logical sequence in these playlists, which could be useful to you. Please share the link with your friends who you think would also benefit from them. If you like these videos, please click on the THUMBS UP button below the video. For email alerts, when new videos are uploaded, you may subscribe to my channel.

Csharp-video-tutorialsBlogspot
Автор

Now a days everyone s using sidebars and nav bars using Bootstrap it’s really a great tool

candyman
Автор

thank u so much brother respect from morroco i hope to uploade some php lessons and u are great teacher <3

anouartaleb
Автор

Lots of thanks to share the knowledge

sinraj
Автор

i've tried to use css on menuHoverStyle but it wont work. why is that?
<StaticHoverStyle CssClass="menuHoverStyle"/>

my Css:
.menuHoverStyle a.static.highlighted
{
background:#5A100C !important;
font:bold !important;
}

paloy
Автор

nice video sir !! Would U please post a video on Task class of c# ? Thank U ...

MrAnupamBorah
Автор

hi sir.... please upload videos about ASP.NET MVC and javascript + css

theesunnlightt
Автор

Hello venkat I likes your videos thanks I got job right now. When I am navigate to my pages I got an error http 404 resource can’t found and there is no mistake in my project but it takes requested URL wrong like http:/cami/pages/pages/about us rather than http:/cami/pages/aboutus. PleSe give some solution I searched google also but didn’t found.thanks

monikamangal
Автор

Hi, can u make a tutorial to hide and unhide the menus and sub menus before login.

imranqureshi
Автор

<StaticMenuItemStyle BorderColor="YellowGreen" BorderWidth="1px" BorderStyle="Ridge" />
its not working

yogeshwarigowda
Автор

Sometimes Your Voice seems like SACHIN TENDULKAR...

VickyMoorjani