CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 9/5/2006 3:56:39 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 4 Views: 27 Favorited: 0 Favorite
5 Items, 1 Pages 1 |< << Go >> >|
CoolKiwiBloke
Asp.Net User
Menu Control9/5/2006 3:56:39 PM

0

I'm trying to get the selected menu item on the Menu Control to appear in a different colour. I can do it when using a sitemap, but I can't do it when loading the MenuItems directly.

 

Can anyone help? Code follows which is saved in Test2.aspx. Cheers,

 

<%@Page Language="C#" %><%

%><!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title>Untitled Page</title>

</head>

<body>

<form id="form1" runat="server">

<div>

<asp:Menu

ID="Menu2"

StaticDisplayLevels="1"

runat="server">

<StaticMenuItemStyle HorizontalPadding="10px" Height="2em"/>

<StaticHoverStyle BackColor="#F1CB6F"/>

<StaticSelectedStyle BackColor="#F1CB6F"/>

<Items>

<asp:MenuItem NavigateUrl="~/Test2.aspx" Text="Bloody Test" runat="server"/>

</Items>

</asp:Menu>

</div>

</form>

</body>

</html>


www.creative-dreaming.com | www.independent-investor.com | www.buffettcup.com | www.thepropertyinvestmentshop.co.uk
joeaudette
Asp.Net User
Re: Menu Control9/5/2006 5:58:06 PM

0

How does it know which item is selected? Are you assuming since there is only 1 item it must be selected?

Did you try Selected="true"?

<Items>

<asp:MenuItem NavigateUrl="~/Test2.aspx" Text="Bloody Test" runat="server" Selected="true"/>

</Items>

Hope it helps,

Joe 


http://www.joeaudette.com
http://www.mojoportal.com
mojoPortal is an Open Source CMS/Portal featuring WebParts and supporting MSSQL, MySQL, PostgreSQL, SQLite, and Firebird Sql
CoolKiwiBloke
Asp.Net User
Re: Menu Control9/5/2006 6:03:15 PM

0

'Selected' on the Menu control refers to it being the current page... hence it *should* be comparing the current URL with each URL in the menu and then if there is a match then that is the 'selected' menu item - which should then be displayed accordingly.

It works perfectly when using a sitemap, but the Microsoft documentation implies that it should also work when loading the menu items manually.

joeaudette:

How does it know which item is selected? Are you assuming since there is only 1 item it must be selected?

Did you try Selected="true"?

<Items>

<asp:MenuItem NavigateUrl="~/Test2.aspx" Text="Bloody Test" runat="server" Selected="true"/>

</Items>

Hope it helps,

Joe 


www.creative-dreaming.com | www.independent-investor.com | www.buffettcup.com | www.thepropertyinvestmentshop.co.uk
joeaudette
Asp.Net User
Re: Menu Control9/5/2006 6:57:42 PM

0

menu.SelectedItem refers to the item selected by the user and would likely be only useful if the menu is posting back

http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.menu.selecteditem.aspx 

I think the SiteMapProvider is setting the .Selected property on the MenuItem during databinding

I don't see anything implying that it should automatically select based on the NavigateUrl, in the example here

http://msdn2.microsoft.com/en-us/library/ecs0x9w5.aspx

manually adding items they are not even using the NavigateUrl property 

The SiteMapProvider may be using the NavigateUrl to determine which item to select during data binding but I don't think the Menu control itself will do that. 

 


http://www.joeaudette.com
http://www.mojoportal.com
mojoPortal is an Open Source CMS/Portal featuring WebParts and supporting MSSQL, MySQL, PostgreSQL, SQLite, and Firebird Sql
CoolKiwiBloke
Asp.Net User
Re: Menu Control9/5/2006 7:49:04 PM

0

Cheers for that - very useful.
www.creative-dreaming.com | www.independent-investor.com | www.buffettcup.com | www.thepropertyinvestmentshop.co.uk
5 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Mac OS X: The Missing Manual Authors: David Pogue, Pages: 583, Published: 2002
Professional ASP.NET 2.0 Authors: Bill Evjen, Scott Hanselman, Farhan Muhammad, Srinivasa Sivakumar, Devin Rader, Pages: 1253, Published: 2005
The Macintosh Bible: Thousands of Basic and Advanced Tips, Tricks, and Shortcuts Logically Organized and Fully Indexed Authors: Sharon Aker, Arthur Naiman, Pages: 1241, Published: 1993
Proceedings of the IEEE 1997 National Aerospace and Electronics Conference, NAECON 1997: Held at the U.S. Air and Trade Show, Dayton, Ohio, July 14-17, 1997 Authors: Institute of Electrical & Electronics Engineers, Institute of Electrical and Electronics Engineers Dayton Section, IEEE National Aerospace, IEEE Aerospace and Electronic Systems Society, IEEE Aerospace and Electronic Systems Society, Electronics Conference, IEEE., Dayton Section, Pages: 1079, Published: 1997
Windows 95 Secrets Authors: Brian Livingston, Davis Straub, Pages: 1126, Published: 1997
ASP.NET 2.0: Your Visual Blueprint for Developing Web Applications Authors: Chris Love, Pages: 339, Published: 2007

Web:
ASP.NET Menu Control Overview The ASP.NET Menu control allows you to develop both statically and dynamically displayed menus for your ASP.NET Web pages. You can configure the contents of ...
Menu Class (System.Web.UI.WebControls) When the user clicks a menu item, the Menu control can either navigate to a linked Web page or ..... Bind the Menu control to a SiteMapDataSource control. ...
CodeProject: Populating Menu Control in ASP.NET 2.0 - using ... An article on how to populate the Menu control in ASP.NET 2.0 using different data sources.; Author: azamsharp; Section: Menus; Chapter: Desktop ...
ASP.NET 2.0: Using the Menu Control NET 2.0 controls is the Menu Control. Once you get past the short learning curve , its easy to set up and maintain, and highly customizable. ...
ASP.NET AJAX Menu Control: Drop Down JavaScript Menu – Office 2007 ... Drop-down Javascript Menu Control for ASP.NET AJAX by Telerik - vendor of ASP. NET and Windows Forms UI components, Content Management Systems (CMS), ...
Asp.Net Menu Control Binding with XMLDataSource - Binding ... This article explains the concept of building dynamic navigation control in web applications using Asp.Net Menu Control binding with XMLDataSource.
ASP.NET Menu - Drop Down Menu Control by ComponentArt Complete Client-side API: ComponentArt Menu is the only menu control featuring a complete client-side API: with the ability to create, change or delete menu ...
Using the YUI Menu Control May 2, 2007 ... Once you have downloaded it, open it and look for the following files which the menu control depends on for its behavior and default ...
CoolMenu: A Silverlight Menu Control CoolMenu is a Silverlight container control that gives you a nice wave-like effect as you move your mouse over the menu items. Clicking a menu item causes ...
Flex 3 - Menu control The Menu control is a pop-up control that contains a menu of individually selectable choices. You use ActionScript to create a Menu control that pops up in ...

Videos:
Silverlight FishEye menu control This control allows to dinamicallay create a fish eye menu based on Silverlight technology.
Adding Visual Studio 2008 Menu Control to A Website Navigation is very important in a website, in this video i'll be showing you how to easily add navigation to your website using the web.sitemap file ...
Star Fox (SNES) - Control Menu (Pumarega Type D Remix) This is a quick remix I put together of the StarFox (SNES) Control Menu music. I wanted a kind of space-hop vibe to it. I'm sure I'm going to piss ...
NES Goonies 2 (USA) in 16:45.85 Made by Johan Södling (aka. Randil). The previous Goonies 2 movie was faster than its predecessor because of careful menu control. This movie is fas...
How to Make Control Panel Display as a Menu in Start Menu A how to on how to make Windows Vista's Control Panel show up as a menu within the Start Menu
Dr. Terrence Deacon - The Symbolic Species - Part 2 - The Self-Organizing Brain This is part 2 of the Children of The Code Project's interview with leading brain scientist Dr. Terrence Deacon. A full transcript of the interview a...
iriver clix 4gb part 5 menu y control del iriver clix 4gb
Dr. Terrence Deacon - The Symbolic Species - Part 4 - Brain Size Differentiation This is part 4 of the Children of The Code Project's interview with leading brain scientist Dr. Terrence Deacon. A full transcript of the interview a...
Yu-Gi-Oh! Power of Chaos JOEY THE PASSION All Cards Vista PLEASE READ THE DESCRIPTION. http://buianhtuan.wordpress.com/2007/06/04/download-yu-gi-oh-power-of-chaos/ Download EXE Patch: http://m0007.gamecopyw...
Dr. Terrence Deacon - The Symbolic Species - Part 10 Verbal Self Reflectivity This is part 10 of the Children of The Code Project's interview with leading brain scientist Dr. Terrence Deacon. A full transcript of the interview ...












putting content pages in different directory to master page - doesn't work!!!

skins and stylesheet not applied in test folder

login page problem

single or multiple sitemaps?

masterpage and menu controls

can someone please clarify this question with my sitemap

sitemap and menu control

how to generate/create site map in vs.net 2005?

placing things visualy and not appearing where we place them.

using multiple sitemap files in your web site

treeview trivia ... need help

set table attributes via theme stylesheet

menu control - making parent node not clickable

re-registering same component for both master/placeholder pages

loading controls dynamically in content page and firing the js events and codebehind events

site maps

setting background color of .selecteditem.parent when a dynamic menuitem is selected?

question on disabled skin controls

custom attributes for sitemapnode in sitemap file

is it possible to have more than one root menu item?

menu item selection

i cant navigate the wizard

sitemap issue: enable securitytrimming will disable external link in sitemap

returning back on navigation

asp.net menu control problem

master page and textbox

problem using master page in subfolders

master page + user control + theme + src problem

override meta tags in masterpage at the page level

problem in customizing the menu control in asp.net 2.0

 
Search This Site:

 
  Privacy | Contact Us
All Times Are GMT