Welcome Guest Search | Active Topics | Sign In | Register

Selected Menu Item Options
Rey
Posted: Saturday, February 27, 2010 10:42:21 AM
Rank: Newbie
Groups: Member

Joined: 2/14/2008
Posts: 2
for the EO.Web Menu:

How can you get the menu item selected, highlighthed or mark differently (like bold) when the item was clicked.

Example:
When I clicked the Customers (from the Menu) it will go to the Customers.aspz page and I want that Customers hghlighted from the Menu.

I'm using VS 2005 and .Net 3.5
eo_support
Posted: Monday, March 1, 2010 9:40:26 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

In order to have the menu item to be marked differently, you must:

1. Switch the menu item into "Selected" state, and
2. Provide a different "SelectedStyle" for menu items

See here for more information about menu item state and style:

http://doc.essentialobjects.com/library/1/menucommon/styleandappearance/item_state.aspx
http://doc.essentialobjects.com/library/1/menucommon/styleandappearance/menu_item_styles.aspx

There are several ways to set the menu item to "Selected" state:

1. Automatically set it based on the current Url. This works if you use the menu inside a master page and each menu item goes to a different Url (by setting the item's NavigateUrl property). In this case you can set the menu to automatically "select" the item that matches the current Url by setting the menu's AutoSelectSource to "Item" or "Path";

2. Set it with server side code. If you do it this way, you will need to set the menu's RaisesServerEvent to true, then handle ItemClick event. Inside the event handler you can set the item's Selected property to true. Note this method does not work if you use NavigateUrl because NavigateUrl and server event do not work at the same time. Here is an example about how to handle server side event:

http://demo.essentialobjects.com/Default.aspx?path=Menu\menu_programming\_i1\menu_server_event

3. Set it with client side code. You will need to handle the menu's ClientSideOnItemClick event with JavaScript, then call setSelected method on the clicked item object to put the menu item into selected state. Here is an example on how to handle client side event:

http://demo.essentialobjects.com/Default.aspx?path=Menu\menu_programming\_i2\menu_client_event

Hope this helps.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.