Menu Control - One Menu Item Should Be With Selected Item Style?
Mar 5, 2009
i have added 5 menu items in my menu control dynamically from database.when i click Item1 it redirect me to Page1 and Item1 color changes to selected.when i click Item2 it redirect to Page2 and Item1 color changes to selected.But still Item1 colors is selected. I just want only one menu item should be with selected item style....
I had added one static menu in my master page. on each menu item click i am redirecting page to corresponding link mentioned in the menu navigate url property. What happening is i had one selected item style. if the page simply post back selected item style will work. but if do redirect the page to another page selected style won't working.
I want to apply a css class to the level 1 menu item (parent) when it or any or it's children are selected. I've looked at MSDN documentation and any number of examples and walkthroughs but I haven't come up with a way of managing this. I was thinking something like this might work but the style is not being applied to the parent. To further complicate matters, if I try to apply a css style to StaticSelectedStyle it doesn't pick it up at all.
I am using frames in my webpage.in one of the frames i have a menu control whose items are database driven.when click on the menu item, i want another page to be displayed in other frame.
now i want to pass the the selected menu item text to the other page using session variable which is in the menu item click event method.but the thing is when i click on the menu item, the click event is not firing.
is there any better way to pass the selected menu item text to the other page?
My menu control is in horizotal style and i want to show it's dynamic item also in horizontal style too, by default they are vertical. Plus the arrow(Static pop-out image) to be shown vertical rather horizotal which is by default. How to do that ?
I have two ASP.NET Menu controls on a page. One in my header (tabs) for top level pages, e.g. ~/Default.aspx And one in my sidebar for sub pages, e.g. ~/Products/SomeProduct.aspxI'm using the selected CSS class to ensure that the selected tab is a different colour.Works fine for top level pages, but if I view a sub page, the tab isn't assigned a CSS class of selected.How can I ensure that the top level menu item has a CSS class of selected when viewing a sub page?
In the MasterPage i am using a menu control and it works fine, code behind is in masterpage.master.vb .Currently i am binding the menu directly from database My problem is that while clicking on the menu the clicked menu item is not highlighting. I tried with StaticSelectedStyle and DynamicSelectedStyle but no effect. The menu control code is as followes
Sub BindMenu() Dim connectionString As String = WebConfigurationManager.ConnectionStrings("DatabaseConnectionString1").ConnectionString Dim con As New MySqlConnection(connectionString) Dim dadCategories As New MySqlDataAdapter("SELECT SubCategory_id,Category_id,SubCategory_desc FROM subCategory where Category_id = '2'order by SubCategory_desc", con) Dim dsCat As New DataSet() Using con con.Open() dadCategories.Fill(dsCat, "category") End Using Dim count As Integer = 0 For Each categoryRow As DataRow In dsCat.Tables("category").Rows Dim mNode As New MenuItem(CType(categoryRow("SubCategory_desc"), String), "", "", "~/items.aspx?pid=" + CType(categoryRow("SubCategory_id"), String), "_parent") Menu1.Items.Add(mNode) Next count = count + 1 End Sub
I am working with asp.net 2.0 I have 1 problem Regarding Menu Control I used menu control in Master page. Now I have to find out Menu Item from Menu control depending on Condition. how to do that on server and Client side.
I need to change the background color of each menu item of asp menu control while the menu items are populate dynamically using a database. i.e. 1st menu item in black background, 2nd in green and 3rd in red and so on. If you can explain using C# it is great.
i am using asp:menu for showing the menus in masterpage. If i click the menu item 1, the corresponding page is loading in the content page. I need that the selected Menu item should be highlighted by some color.
I have a master page (Site.master) with a navigation menu linked to a datasource (Master.sitemap). I have a nested master page that has another navigation menu. For any item clicked in this nested navigation menu, I want a particular menu item in the Site.master navigation menu to be selected.
Here's my Site.master menu: [Code]....
In my Site.master.cs I have this: [Code]....
In the nested master page, Products.master I have this: [Code]....
In the Products.master.cs file I try to change the selected item. [Code]....
The master navigation and products navigation menus work just fine by themselves. But when I've tried to set the selected item of the master menu in the Page_Load above, I can't seem to access it. What I've found in trying to do this is the NavigationMenu seems to be uninitialized. The menu Items list is empty. What am I missing here? Why are there no menuItems in the Master.NavigationMenu control?
Does anyone know how to set a selected asp.net dynamic menu item to false? I have multiple menus and when someone selects an item from one of the dropdown menus it changes color. If I were to select an item from a different menu I need the other menus not to have the selected option anymore.
I'v been looking for ages on how to get the current selected menu item into a label. so for example on the menu you have home and about, if i click on about it will but the text "About" in the labels text whats in the body of the form. You could say its a sub heading and i would like to do this in c# ;) somthing like this:
lblHeading.Text = Menu1.Page.Title.ToString(); except this retutns the tabpage title not the actual menu item i selected.
how to change the background color of a selected menu item? The background color changes on the word of the dropdown menu but not the entire row section of the menu item. Each menu item has a different word length but I want the background color length to be consistent throughout the dropdown dynamic menu. I also what to change the background parent when a menu item is selected.
I have a nested master-page szenario: content.aspx - subsite.master - site.master. The site.master contains a Menu-control with a SiteMapDataSource. Problem 1 (solved): I don't want to display all the nodes in this menu cause some nested nodes should be displayed in the menu in subsite.master. Therefore I use MenuItemDataBound to remove the unwanted nodes. => Problem 1 solved
Problem 2 (solved): I want to maintain the selected element of the Menu in site.master when the user is navigating with the sub-menu in subsite.master, so he is calling different .aspx sites. Therefore created a property in the site.master which is set by the aspx sites.
I am using frames in my webpage.in one of the frames i have a menu control whose items are database driven.when click on the menu item, i want another page to be displayed in other frame. now i want to pass the the selected menu item text to the other page using session variable which is in the menu item click event method.but the thing is when i click on the menu item, the click event is not firing. is there any better way to pass the selected menu item text to the other page?
i have a menu which is collapses as a default. This is done by following query.
Now, the problem is, whenever i click on any menu item by expanding the menu, the item page opens but the menu collapses again. I want to let the menu remain as expanded although a menu item is clicked. i.e. menu shouldn't refresh when a menu item is clicked.
I tried using the the New ASP.NET Default Web Template in Visual Studio 2010 but one issue I'm encountering is with the CSS selected menu item and read apost which stated that...
"This screenshot demonstrates some of the styling options provided by the CSS, including the style for the selected About menu item"...In the screenshot the "About Us" menu item is highlighted but the page's content is the "Home" page content, not "About Us" page. My problem is...I can't get the selected item to be highlighted as in the screenshot even with fresh site using the built in template.