We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Menu Item Looks and Event Handlers

Hi,

My requirement is to create a horizontal menu bar with say about 5 items(picked from the DB). If I click on the item, it needs to display the sub menu in a horizontal menu bar, instead of the normal vertical display. I also want the main menu items to have different colors upon their selection.

I am trying to use some styling on the Menu bar and menu items in them. I have created a custom file (CustomMenu.css). I tried the using the vaious classes that are a part of MenuItemLook (eg : ItemCSSClass, ItemContCssClass, etc), they dont seem to work when I give custom class names, but they work with the default class names. The only problem with default class names is that I would not be able to change the look of the menu item dynamically (depending on the tab selected). Have tried all the options in the http://www2.syncfusion.com/ug_62/toolsweb/default.html, but no use.

As for the event handlers, I am not able to trigger the event. The method name is defined in the properties of the Menu. I have defined the method as follows :

protected bool Menu1_ItemSelect(object oSender, Syncfusion.Web.UI.WebControls.Tools.MenuCommandEventArgs e)
{
// My method definition
}

public void Menu1_ItemCommand(object oSender, Syncfusion.Web.UI.WebControls.Tools.MenuCommandEventArgs e)
{
// Method Definition
}

Any help will be greatly Appreciated.

Thanks
Preetha


1 Reply

MW Melba Winshia Syncfusion Team May 27, 2008 09:35 AM UTC

Hi Preetha,

We regret for the delayed response.

1) Issue while changing the look of the menu item dynamically :

You can have different colors for main menu item depending upon menu item selection by using below code snippet:



protected bool Menu1_ItemSelect(object oSender, Syncfusion.Web.UI.WebControls.Tools.MenuCommandEventArgs e)
{

if (e.Item.Text == "View")
{
MenuItemLook look = new MenuItemLook();
look.ID = "RootItemsLook";
look.StateDataDefault.TextContainerCSSClass= "View";
Menu1.ItemLooks.Add(look);
e.Item.Look = "RootItemsLook";
return true;
}
}





Please refer the sample in the below link which illustrates the above:

http://websamples.syncfusion.com/samples/Tools.Web/6.2.0.40/Tools_Asp_Menu_73829/main.htm


2) I am not able to trigger the event :

I am afraid that I am not able to reproduce this issue. Please refer the test sample that I have used to test this issue:

http://websamples.syncfusion.com/samples/Tools.Web/6.2.0.40/Tools_Asp_Menu_73829/main.htm

Please have a look at the above sample and if still the issue exists, could you please try reproducing it in the above sample or send us the modified sample so that we could sort out the cause of the issue and provide you a solution?

Thanks,
Melba






Loader.
Live Chat Icon For mobile
Up arrow icon