Welcome Guest Search | Active Topics | Sign In | Register

Menu Builder Options
Boranet
Posted: Thursday, August 23, 2007 5:10:26 AM
Rank: Advanced Member
Groups: Member

Joined: 7/25/2007
Posts: 34
I know that there are very style menu behaviors whe the user passes the mouse over the button and when he clicks on them, but i don't know how to mantain the style of a button after the user click on it.

Thanks
eo_support
Posted: Thursday, August 23, 2007 5:47:52 AM
Rank: Administration
Groups: Administration

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

For that you will need to make use of the "Selected" state:
1. Provide style settings for "Selected" state. It can be the same as "Hover" state or something different. That's up to you;
2. Switch the menu item into "Selected" state after it is clicked;

To complete the first step, you simply use the Menu Builder. To complete the second step, there are a number of options for different scenarios:

1. If you use NavigateUrl, then you can set this property to NavigateUrl:
http://www.essentialobjects.com/ViewDoc.aspx?t=EO.Web.BaseNavigator.AutoSelectSource.html
2. If you use server events, you can use the following code in your server side event handler to set the item's Selected to true:

Code: C#
private void Menu1_ItemClick(
    object sender, EO.Web.NavigationItemEventArgs e)
{
    e.MenuItem.Selected = true;
}


3. If you do not use serer events, you can handle ClientSideOnItemClick:

Code: JavaScript
function item_click_handler(e, info)
{
    info.getItem().setSelected(true);
}


Once you have those in place, every time a menu item is clicked, it is switched into Selected state thus applies SelectedStyle. One thing that you want to keep in mind is that setting one item's Selected to true does not clear another item's Selected ---- a single menu can have multiple Selected item. So you may want to put in additional code to clear the previous selected item when you set a new selected item.

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.