protected void dgProducts_ItemCreated(object sender, DataGridItemEventArgs e)
    {
        if (e.Item.ItemType != ListItemType.Header && e.Item.ItemType != ListItemType.Footer)
        {
            PlaceHolder PlaceHolder1 = (PlaceHolder)e.Item.FindControl("PlaceHolder1");

            EasyMenu EasyMenu1 = new EasyMenu();
            EasyMenu1.ID = "EasyMenu1_" + e.Item.ItemIndex.ToString();
            EasyMenu1.ShowEvent = MenuShowEvent.Always;
            EasyMenu1.Position = MenuPosition.Horizontal;
			EasyMenu1.StyleFolder = "styles/horizontal1";
            EasyMenu1.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu1.ID + "_item1", "Buy for...", "", "", "", ""));
			EasyMenu1.AddItem(new OboutInc.EasyMenu_Pro.MenuSeparator(EasyMenu1.ID + "_separator1", "|"));
            EasyMenu1.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu1.ID + "_item2", "Rent for...", "", "", "", ""));
			EasyMenu1.Width = "100%";
			
			EasyMenu EasyMenu2 = new EasyMenu();
			EasyMenu2.ID = "EasyMenu2_" + e.Item.ItemIndex.ToString();
			EasyMenu2.ShowEvent = MenuShowEvent.MouseOver;
			EasyMenu2.Position = MenuPosition.Vertical;
			EasyMenu2.StyleFolder = "styles/horizontal1";
			EasyMenu2.AttachTo = EasyMenu1.ID + "_item1";
			EasyMenu2.Align = MenuAlign.Right;
			switch(e.Item.ItemIndex)
			{
				case 0:
					EasyMenu2.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu2.ID + "_item1", "49.99$ for a piece", "", "", "", ""));
					EasyMenu2.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu2.ID + "_item2", "89.99$ for two pieces", "", "", "", ""));
				break;
				case 1:
					EasyMenu2.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu2.ID + "_item1", "29.99$ for a piece", "", "", "", ""));
					EasyMenu2.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu2.ID + "_item2", "54.99$ for two pieces", "", "", "", ""));
					EasyMenu2.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu2.ID + "_item3", "99.99$ for four pieces", "", "", "", ""));
				break;
			}
			
			EasyMenu EasyMenu3 = new EasyMenu();
			EasyMenu3.ID = "EasyMenu3_" + e.Item.ItemIndex.ToString();
			EasyMenu3.ShowEvent = MenuShowEvent.MouseOver;
			EasyMenu3.Position = MenuPosition.Vertical;
			EasyMenu3.StyleFolder = "styles/horizontal1";
			EasyMenu3.AttachTo = EasyMenu1.ID + "_item2";
			EasyMenu3.Align = MenuAlign.Right;
			switch(e.Item.ItemIndex)
			{
				case 0:
					EasyMenu3.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu3.ID + "_item1", "2.99$ for a day", "", "", "", ""));
					EasyMenu3.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu3.ID + "_item2", "4.99$ for two days", "", "", "", ""));
					EasyMenu3.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu3.ID + "_item3", "9.99$ for a week", "", "", "", ""));
				break;
				case 1:
					EasyMenu3.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu3.ID + "_item1", "Not Available", "", "", "", ""));
					break;
			}

            PlaceHolder1.Controls.Add(EasyMenu1);
			PlaceHolder1.Controls.Add(EasyMenu2);
			PlaceHolder1.Controls.Add(EasyMenu3);
        }
    }
Example #2
0
    private void BuildMenu1(OleDbDataReader oReader)
    {
        /*** main menu - records with ParentId = 0 ***/
        EasyMenu mainEM = null;
        /*** ***/

        /*** list with child menus ***/
        Hashtable childMenus = null;

        while (oReader.Read())
        {
            int parentId = oReader.GetInt32(1);
            if (parentId == 0)
            {
                if (mainEM == null)
                {
                    mainEM             = new EasyMenu();
                    mainEM.ID          = "mainEM";
                    mainEM.StyleFolder = "styles/horizontal1";
                    mainEM.Width       = "400";
                    mainEM.ShowEvent   = MenuShowEvent.Always;
                    mainEM.Position    = MenuPosition.Horizontal;

                    // css classes names for the menu and the item container
                    mainEM.CSSMenu = "ParentMenu";
                    mainEM.CSSMenuItemContainer = "ParentItemContainer";

                    // css classes names for MenuItems
                    CSSClasses MenuItemCssClasses = mainEM.CSSClassesCollection[mainEM.CSSClassesCollection.Add(new CSSClasses(typeof(OboutInc.EasyMenu_Pro.MenuItem)))];
                    MenuItemCssClasses.ComponentSubMenuCellOver = "ParentItemSubMenuCellOver";
                    MenuItemCssClasses.ComponentContentCell     = "ParentItemContentCell";
                    MenuItemCssClasses.Component                = "ParentItem";
                    MenuItemCssClasses.ComponentSubMenuCell     = "ParentItemSubMenuCell";
                    MenuItemCssClasses.ComponentIconCellOver    = "ParentItemIconCellOver";
                    MenuItemCssClasses.ComponentIconCell        = "ParentItemIconCell";
                    MenuItemCssClasses.ComponentOver            = "ParentItemOver";
                    MenuItemCssClasses.ComponentContentCellOver = "ParentItemContentCellOver";
                    // add the classes names to the collection
                    mainEM.CSSClassesCollection.Add(MenuItemCssClasses);

                    // css classes names for MenuSeparators
                    CSSClasses MenuSeparatorCssClasses = mainEM.CSSClassesCollection[mainEM.CSSClassesCollection.Add(new CSSClasses(typeof(MenuSeparator)))];
                    MenuSeparatorCssClasses.ComponentSubMenuCellOver = "ParentSeparatorSubMenuCellOver";
                    MenuSeparatorCssClasses.ComponentContentCell     = "ParentSeparatorContentCell";
                    MenuSeparatorCssClasses.Component                = "ParentSeparator";
                    MenuSeparatorCssClasses.ComponentSubMenuCell     = "ParentSeparatorSubMenuCell";
                    MenuSeparatorCssClasses.ComponentIconCellOver    = "ParentSeparatorIconCellOver";
                    MenuSeparatorCssClasses.ComponentIconCell        = "ParentSeparatorIconCell";
                    MenuSeparatorCssClasses.ComponentOver            = "ParentSeparatorOver";
                    MenuSeparatorCssClasses.ComponentContentCellOver = "ParentSeparatorContentCellOver";
                    // add the classes names to the collection
                    mainEM.CSSClassesCollection.Add(MenuSeparatorCssClasses);
                }

                mainEM.AddItem(new OboutInc.EasyMenu_Pro.MenuItem("item_" + oReader.GetInt32(0).ToString(), oReader.GetString(2), "", "", "", ""));

                placeHolder1.Controls.Add(mainEM);
            }
            else
            {
                if (childMenus == null)
                {
                    childMenus = new Hashtable();
                }

                /* first time the menu is ceated */
                if (!childMenus.ContainsKey(parentId))
                {
                    EasyMenu childEM = new EasyMenu();
                    childEM.ID          = "childEM_" + parentId;
                    childEM.StyleFolder = "styles/horizontal1";
                    childEM.ShowEvent   = MenuShowEvent.MouseOver;
                    childEM.AttachTo    = "item_" + parentId;
                    childEM.Width       = "150";

                    int menuLevel = oReader.GetInt32(3);
                    if (menuLevel == 1)
                    {
                        childEM.Align = MenuAlign.Under;
                    }
                    else
                    {
                        childEM.Align = MenuAlign.Left;
                    }

                    childEM.AddItem(new OboutInc.EasyMenu_Pro.MenuItem("item_" + oReader.GetInt32(0).ToString(), oReader.GetString(2), "", "", "", ""));

                    childMenus.Add(parentId, childEM);

                    placeHolder1.Controls.Add(childEM);
                }
                /* items are added to the already created menu */
                else
                {
                    EasyMenu childEM = (EasyMenu)childMenus[parentId];

                    childEM.AddItem(new OboutInc.EasyMenu_Pro.MenuItem("item_" + oReader.GetInt32(0).ToString(), oReader.GetString(2), "", "", "", ""));
                }
            }
        }
    }
Example #3
0
    private void BuildMenu2(OleDbDataReader oReader)
    {
        /*** main menu - records with ParentId = 0 ***/
        EasyMenu mainEM = null;
        /*** ***/

        /*** list with child menus ***/
        Hashtable childMenus = null;

        while (oReader.Read())
        {
            int parentId = oReader.GetInt32(1);
            if (parentId == 0)
            {
                if (mainEM == null)
                {
                    mainEM             = new EasyMenu();
                    mainEM.ID          = "VmainEM";
                    mainEM.StyleFolder = "styles/horizontal1";
                    mainEM.Width       = "400";
                    mainEM.ShowEvent   = MenuShowEvent.Always;
                    mainEM.Position    = MenuPosition.Horizontal;
                }

                mainEM.AddItem(new OboutInc.EasyMenu_Pro.MenuItem("Vitem_" + oReader.GetInt32(0).ToString(), oReader.GetString(2), "", "", "", ""));

                placeHolder2.Controls.Add(mainEM);
            }
            else
            {
                if (childMenus == null)
                {
                    childMenus = new Hashtable();
                }

                /* first time the menu is ceated */
                if (!childMenus.ContainsKey(parentId))
                {
                    EasyMenu childEM = new EasyMenu();
                    childEM.ID          = "VchildEM_" + parentId;
                    childEM.StyleFolder = "styles/horizontal1";
                    childEM.ShowEvent   = MenuShowEvent.MouseOver;
                    childEM.AttachTo    = "Vitem_" + parentId;
                    childEM.Width       = "150";

                    int menuLevel = oReader.GetInt32(3);
                    if (menuLevel == 1)
                    {
                        childEM.Align = MenuAlign.Under;
                    }
                    else
                    {
                        childEM.Align = MenuAlign.Left;
                    }

                    childEM.AddItem(new OboutInc.EasyMenu_Pro.MenuItem("Vitem_" + oReader.GetInt32(0).ToString(), oReader.GetString(2), "", "", "", ""));

                    childMenus.Add(parentId, childEM);

                    placeHolder1.Controls.Add(childEM);
                }
                /* items are added to the already created menu */
                else
                {
                    EasyMenu childEM = (EasyMenu)childMenus[parentId];

                    childEM.AddItem(new OboutInc.EasyMenu_Pro.MenuItem("Vitem_" + oReader.GetInt32(0).ToString(), oReader.GetString(2), "", "", "", ""));
                }
            }
        }
    }
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                // set the style for this menu
                mainEM.StyleFolder = "styles/horizontal1";
                mainEM.Width       = "330";
                // show event is always so the menu is always visible
                // this menu doesn't require any AttachTo or Align properties set
                mainEM.ShowEvent = MenuShowEvent.Always;
                // display the menu horizontally
                mainEM.Position = MenuPosition.Horizontal;

                // the parent menu looks different so we need to set different
                // CSS classes names for its items and the menu itself

                // css classes names for the menu and the item container
                mainEM.CSSMenu = "ParentMenu";
                mainEM.CSSMenuItemContainer = "ParentItemContainer";

                // css classes names for MenuItems
                CSSClasses MenuItemCssClasses = mainEM.CSSClassesCollection[mainEM.CSSClassesCollection.Add(new CSSClasses(typeof(MenuItem)))];
                MenuItemCssClasses.ComponentSubMenuCellOver = "ParentItemSubMenuCellOver";
                MenuItemCssClasses.ComponentContentCell     = "ParentItemContentCell";
                MenuItemCssClasses.Component                = "ParentItem";
                MenuItemCssClasses.ComponentSubMenuCell     = "ParentItemSubMenuCell";
                MenuItemCssClasses.ComponentIconCellOver    = "ParentItemIconCellOver";
                MenuItemCssClasses.ComponentIconCell        = "ParentItemIconCell";
                MenuItemCssClasses.ComponentOver            = "ParentItemOver";
                MenuItemCssClasses.ComponentContentCellOver = "ParentItemContentCellOver";
                // add the classes names to the collection
                mainEM.CSSClassesCollection.Add(MenuItemCssClasses);

                // css classes names for MenuSeparators
                CSSClasses MenuSeparatorCssClasses = mainEM.CSSClassesCollection[mainEM.CSSClassesCollection.Add(new CSSClasses(typeof(MenuSeparator)))];
                MenuSeparatorCssClasses.ComponentSubMenuCellOver = "ParentSeparatorSubMenuCellOver";
                MenuSeparatorCssClasses.ComponentContentCell     = "ParentSeparatorContentCell";
                MenuSeparatorCssClasses.Component                = "ParentSeparator";
                MenuSeparatorCssClasses.ComponentSubMenuCell     = "ParentSeparatorSubMenuCell";
                MenuSeparatorCssClasses.ComponentIconCellOver    = "ParentSeparatorIconCellOver";
                MenuSeparatorCssClasses.ComponentIconCell        = "ParentSeparatorIconCell";
                MenuSeparatorCssClasses.ComponentOver            = "ParentSeparatorOver";
                MenuSeparatorCssClasses.ComponentContentCellOver = "ParentSeparatorContentCellOver";
                // add the classes names to the collection
                mainEM.CSSClassesCollection.Add(MenuSeparatorCssClasses);

                // add the items for the menu
                mainEM.AddItem(new MenuItem("item1", "Item 1", "", "", "", ""));
                mainEM.AddItem(new MenuItem("item2", "Item 2", "", "", "", ""));
                mainEM.AddItem(new MenuItem("item3", "Item 3", "", "", "", ""));
                mainEM.AddItem(new MenuItem("item4", "Item 4", "", "", "", ""));
                mainEM.AddItem(new MenuItem("item5", "Item 5", "", "", "", ""));

                // this will attach to the first item of the parent menu (id=item1)
                em_1.AttachTo    = "item1";
                em_1.StyleFolder = "styles/horizontal1";
                em_1.Width       = "140";
                // it will show on mouse over
                em_1.ShowEvent = MenuShowEvent.MouseOver;
                // and will align under the item to which it is attached
                em_1.Align = MenuAlign.Under;
                // here are this menu's items
                em_1.AddItem(new MenuItem("menuItem1", "SubItem 1", "", "", "", "alert('Item 1 - SubItem 1')"));
                em_1.AddItem(new MenuItem("menuItem2", "SubItem 2", "", "", "", "alert('Item 1 - SubItem 2')"));
                em_1.AddItem(new MenuItem("menuItem3", "SubItem 3", "", "", "", "alert('Item 1 - SubItem 3')"));
                em_1.AddItem(new MenuItem("menuItem4", "SubItem 4", "", "", "", "alert('Item 1 - SubItem 4')"));
                em_1.AddItem(new MenuItem("menuItem5", "SubItem 5", "", "", "", "alert('Item 1 - SubItem 5')"));

                em_2.AttachTo    = "item2";
                em_2.StyleFolder = "styles/horizontal1";
                em_2.Width       = "140";
                em_2.ShowEvent   = MenuShowEvent.MouseOver;
                em_2.Align       = MenuAlign.Under;
                em_2.AddItem(new MenuItem("menuItem6", "SubItem 1", "", "", "", "alert('Item 2 - SubItem 1')"));
                em_2.AddItem(new MenuItem("menuItem7", "SubItem 2", "", "", "", "alert('Item 2 - SubItem 2')"));
                em_2.AddItem(new MenuItem("menuItem8", "SubItem 3", "", "", "", "alert('Item 2 - SubItem 3')"));

                em_4.AttachTo    = "item4";
                em_4.StyleFolder = "styles/horizontal1";
                em_4.Width       = "140";
                em_4.ShowEvent   = MenuShowEvent.MouseOver;
                em_4.Align       = MenuAlign.Under;
                em_4.AddItem(new MenuItem("menuItem9", "SubItem 1", "", "", "", "alert('Item 4 - SubItem 1')"));
                em_4.AddItem(new MenuItem("menuItem10", "SubItem 2", "", "", "", "alert('Item 4 - SubItem 2')"));

                em_5.AttachTo    = "item5";
                em_5.StyleFolder = "styles/horizontal1";
                em_5.Width       = "140";
                em_5.ShowEvent   = MenuShowEvent.MouseOver;
                em_5.Align       = MenuAlign.Under;
                em_5.AddItem(new MenuItem("menuItem11", "SubItem 1", "", "", "", "alert('Item 5 - SubItem 1')"));
                em_5.AddItem(new MenuItem("menuItem12", "SubItem 2", "", "", "", "alert('Item 5 - SubItem 2')"));
                em_5.AddItem(new MenuItem("menuItem13", "SubItem 3", "", "", "", "alert('Item 5 - SubItem 3')"));
                em_5.AddItem(new MenuItem("menuItem14", "SubItem 4", "", "", "", "alert('Item 5 - SubItem 4')"));
                em_5.AddItem(new MenuItem("menuItem15", "SubItem 5", "", "", "", "alert('Item 5 - SubItem 5')"));

                em_6.AttachTo         = "menuItem3";
                em_6.StyleFolder      = "styles/horizontal1";
                em_6.Width            = "140";
                em_6.ShowEvent        = MenuShowEvent.MouseOver;
                em_6.Align            = MenuAlign.Right;
                em_6.OffsetVertical   = 0;
                em_6.OffsetHorizontal = -4;
                em_6.AddItem(new MenuItem("menuItem31", "SubItem 1", "", "", "", "alert('Item 1 - SubItem 3 - SubItem 1')"));
                em_6.AddItem(new MenuItem("menuItem32", "SubItem 2", "", "", "", "alert('Item 1 - SubItem 3 - SubItem 2')"));
                em_6.AddItem(new MenuItem("menuItem33", "SubItem 3", "", "", "", "alert('Item 1 - SubItem 3 - SubItem 3')"));
            }
        }
        protected void LeerSubmenu(XmlNode menu, string IDParent, Boolean isTopMenu = false)
        {
            string cUrl = "";
            string menuTitle = "";
            string cDescription = "";
            string menuItemID = "";
            int nNumCor = 1;

            EasyMenu menuEM = new EasyMenu();
            menuEM.ID = IDParent + "_Items";
            menuEM.StyleFolder = "App_Themes/TemaAgrocomercio/EasyMenu/Horizontal1";
            menuEM.Width = "140";
            menuEM.ShowEvent = MenuShowEvent.MouseOver;
            menuEM.Align = isTopMenu ? MenuAlign.Under : MenuAlign.Advanced;
            menuEM.AttachTo = IDParent;

            foreach (XmlNode Item in menu)
            {
                cUrl = Item.Attributes["url"].Value;
                menuTitle = Item.Attributes["title"].Value;
                cDescription = Item.Attributes["description"].Value;
                menuItemID = menuEM.ID + "_" + nNumCor.ToString();

                if (menuTitle.Length * 10 > int.Parse(menuEM.Width.Replace("px","")))
                    menuEM.Width = (menuTitle.Length * 10).ToString();
                menuEM.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(menuItemID, menuTitle, "", cUrl, "", ""));

                if (cUrl == "#")
                    LeerSubmenu(Item, menuItemID);
                nNumCor++;
            }
            Menu_placeHolder.Controls.Add(menuEM);
        }
    protected void dgProducts_ItemCreated(object sender, DataGridItemEventArgs e)
    {
        if (e.Item.ItemType != ListItemType.Header && e.Item.ItemType != ListItemType.Footer)
        {
            PlaceHolder PlaceHolder1 = (PlaceHolder)e.Item.FindControl("PlaceHolder1");

            EasyMenu EasyMenu1 = new EasyMenu();
            EasyMenu1.ID          = "EasyMenu1_" + e.Item.ItemIndex.ToString();
            EasyMenu1.ShowEvent   = MenuShowEvent.Always;
            EasyMenu1.Position    = MenuPosition.Horizontal;
            EasyMenu1.StyleFolder = "styles/horizontal1";
            EasyMenu1.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu1.ID + "_item1", "Buy for...", "", "", "", ""));
            EasyMenu1.AddItem(new OboutInc.EasyMenu_Pro.MenuSeparator(EasyMenu1.ID + "_separator1", "|"));
            EasyMenu1.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu1.ID + "_item2", "Rent for...", "", "", "", ""));
            EasyMenu1.Width = "100%";

            EasyMenu EasyMenu2 = new EasyMenu();
            EasyMenu2.ID          = "EasyMenu2_" + e.Item.ItemIndex.ToString();
            EasyMenu2.ShowEvent   = MenuShowEvent.MouseOver;
            EasyMenu2.Position    = MenuPosition.Vertical;
            EasyMenu2.StyleFolder = "styles/horizontal1";
            EasyMenu2.AttachTo    = EasyMenu1.ID + "_item1";
            EasyMenu2.Align       = MenuAlign.Right;
            switch (e.Item.ItemIndex)
            {
            case 0:
                EasyMenu2.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu2.ID + "_item1", "49.99$ for a piece", "", "", "", ""));
                EasyMenu2.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu2.ID + "_item2", "89.99$ for two pieces", "", "", "", ""));
                break;

            case 1:
                EasyMenu2.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu2.ID + "_item1", "29.99$ for a piece", "", "", "", ""));
                EasyMenu2.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu2.ID + "_item2", "54.99$ for two pieces", "", "", "", ""));
                EasyMenu2.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu2.ID + "_item3", "99.99$ for four pieces", "", "", "", ""));
                break;
            }

            EasyMenu EasyMenu3 = new EasyMenu();
            EasyMenu3.ID          = "EasyMenu3_" + e.Item.ItemIndex.ToString();
            EasyMenu3.ShowEvent   = MenuShowEvent.MouseOver;
            EasyMenu3.Position    = MenuPosition.Vertical;
            EasyMenu3.StyleFolder = "styles/horizontal1";
            EasyMenu3.AttachTo    = EasyMenu1.ID + "_item2";
            EasyMenu3.Align       = MenuAlign.Right;
            switch (e.Item.ItemIndex)
            {
            case 0:
                EasyMenu3.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu3.ID + "_item1", "2.99$ for a day", "", "", "", ""));
                EasyMenu3.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu3.ID + "_item2", "4.99$ for two days", "", "", "", ""));
                EasyMenu3.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu3.ID + "_item3", "9.99$ for a week", "", "", "", ""));
                break;

            case 1:
                EasyMenu3.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(EasyMenu3.ID + "_item1", "Not Available", "", "", "", ""));
                break;
            }

            PlaceHolder1.Controls.Add(EasyMenu1);
            PlaceHolder1.Controls.Add(EasyMenu2);
            PlaceHolder1.Controls.Add(EasyMenu3);
        }
    }
		private void Page_Load(object sender, System.EventArgs e)
		{
			if (!Page.IsPostBack)
			{
				// create the Parent EasyMenu
				mainEM = new EasyMenu();
				// set the ID (must be unique)
				mainEM.ID = "MainEM";
				// set the style for this menu
				mainEM.StyleFolder = "styles/horizontal2";
				mainEM.Width = "330";
				// show event is always so the menu is always visible
				// this menu doesn't require any AttachTo or Align properties set
				mainEM.ShowEvent = MenuShowEvent.Always;
				// display the menu horizontally
				mainEM.Position = MenuPosition.Horizontal;

				// the parent menu looks different so we need to set different
				// CSS classes names for its items and the menu itself
				
				// css classes names for the menu and the item container
				mainEM.CSSMenu = "ParentMenu";
				mainEM.CSSMenuItemContainer = "ParentItemContainer";
				
				// css classes names for MenuItems
				CSSClasses MenuItemCssClasses = mainEM.CSSClassesCollection[mainEM.CSSClassesCollection.Add(new CSSClasses(typeof(MenuItem)))];
				MenuItemCssClasses.ComponentSubMenuCellOver="ParentItemSubMenuCellOver";
				MenuItemCssClasses.ComponentContentCell="ParentItemContentCell";
				MenuItemCssClasses.Component="ParentItem";
				MenuItemCssClasses.ComponentSubMenuCell="ParentItemSubMenuCell";
				MenuItemCssClasses.ComponentIconCellOver="ParentItemIconCellOver";
				MenuItemCssClasses.ComponentIconCell="ParentItemIconCell";
				MenuItemCssClasses.ComponentOver="ParentItemOver";
				MenuItemCssClasses.ComponentContentCellOver="ParentItemContentCellOver";
				// add the classes names to the collection
				mainEM.CSSClassesCollection.Add(MenuItemCssClasses);
				
				// css classes names for MenuSeparators
				CSSClasses MenuSeparatorCssClasses = mainEM.CSSClassesCollection[mainEM.CSSClassesCollection.Add(new CSSClasses(typeof(MenuSeparator)))];
				MenuSeparatorCssClasses.ComponentSubMenuCellOver="ParentSeparatorSubMenuCellOver";
				MenuSeparatorCssClasses.ComponentContentCell="ParentSeparatorContentCell";
				MenuSeparatorCssClasses.Component="ParentSeparator";
				MenuSeparatorCssClasses.ComponentSubMenuCell="ParentSeparatorSubMenuCell";
				MenuSeparatorCssClasses.ComponentIconCellOver="ParentSeparatorIconCellOver";
				MenuSeparatorCssClasses.ComponentIconCell="ParentSeparatorIconCell";
				MenuSeparatorCssClasses.ComponentOver="ParentSeparatorOver";
				MenuSeparatorCssClasses.ComponentContentCellOver="ParentSeparatorContentCellOver";
				// add the classes names to the collection
				mainEM.CSSClassesCollection.Add(MenuSeparatorCssClasses);

				// add the items for the menu
				mainEM.AddItem(new MenuItem("item1", "Item 1", "", "", "", ""));
				mainEM.AddItem(new MenuItem("item2", "Item 2", "", "", "", ""));
				mainEM.AddItem(new MenuItem("item3", "Item 3", "", "", "", ""));
				mainEM.AddItem(new MenuItem("item4", "Item 4", "", "", "", ""));
				mainEM.AddItem(new MenuItem("item5", "Item 5", "", "", "", ""));

				// add the menu to the placeholder on the page
				placeHolder1.Controls.Add(mainEM);


				// Create the submenus
				em_1 = new EasyMenu();
				em_1.ID = "Easymenu1";
				// this will attach to the first item of the parent menu (id=item1)
				em_1.AttachTo = "item1";
				em_1.StyleFolder = "styles/horizontal2";
				em_1.Width = "140";
				// it will show on mouse over
				em_1.ShowEvent = MenuShowEvent.MouseOver;
				// and will align under the item to which it is attached
				em_1.Align = MenuAlign.Under;
				// here are this menu's items
				em_1.AddItem(new MenuItem("menuItem1", "SubItem 1", "", "", "", "alert('Item 1 - SubItem 1')"));
				em_1.AddItem(new MenuItem("menuItem2", "SubItem 2", "", "", "", "alert('Item 1 - SubItem 2')"));
				em_1.AddItem(new MenuItem("menuItem3", "SubItem 3", "", "", "", "alert('Item 1 - SubItem 3')"));
				em_1.AddItem(new MenuItem("menuItem4", "SubItem 4", "", "", "", "alert('Item 1 - SubItem 4')"));
				em_1.AddItem(new MenuItem("menuItem5", "SubItem 5", "", "", "", "alert('Item 1 - SubItem 5')"));

				// and so on for every submenu
				em_2 = new EasyMenu();
				em_2.ID = "Easymenu2";
				em_2.AttachTo = "item2";
				em_2.StyleFolder = "styles/horizontal2";
				em_2.Width = "140";
				em_2.ShowEvent = MenuShowEvent.MouseOver;
				em_2.Align = MenuAlign.Under;
				em_2.AddItem(new MenuItem("menuItem6", "SubItem 1", "", "", "", "alert('Item 2 - SubItem 1')"));
				em_2.AddItem(new MenuItem("menuItem7", "SubItem 2", "", "", "", "alert('Item 2 - SubItem 2')"));
				em_2.AddItem(new MenuItem("menuItem8", "SubItem 3", "", "", "", "alert('Item 2 - SubItem 3')"));

				em_4 = new EasyMenu();
				em_4.ID = "Easymenu4";
				em_4.AttachTo = "item4";
				em_4.StyleFolder = "styles/horizontal2";
				em_4.Width = "140";
				em_4.ShowEvent = MenuShowEvent.MouseOver;
				em_4.Align = MenuAlign.Under;
				em_4.AddItem(new MenuItem("menuItem9", "SubItem 1", "", "", "", "alert('Item 4 - SubItem 1')"));
				em_4.AddItem(new MenuItem("menuItem10", "SubItem 2", "", "", "", "alert('Item 4 - SubItem 2')"));

				em_5 = new EasyMenu();
				em_5.ID = "Easymenu5";
				em_5.AttachTo = "item5";
				em_5.StyleFolder = "styles/horizontal2";
				em_5.Width = "140";
				em_5.ShowEvent = MenuShowEvent.MouseOver;
				em_5.Align = MenuAlign.Under;
				em_5.AddItem(new MenuItem("menuItem11", "SubItem 1", "", "", "", "alert('Item 5 - SubItem 1')"));
				em_5.AddItem(new MenuItem("menuItem12", "SubItem 2", "", "", "", "alert('Item 5 - SubItem 2')"));
				em_5.AddItem(new MenuItem("menuItem13", "SubItem 3", "", "", "", "alert('Item 5 - SubItem 3')"));
				em_5.AddItem(new MenuItem("menuItem14", "SubItem 4", "", "", "", "alert('Item 5 - SubItem 4')"));
				em_5.AddItem(new MenuItem("menuItem15", "SubItem 5", "", "", "", "alert('Item 5 - SubItem 5')"));

				em_6 = new EasyMenu();
				em_6.ID = "Easymenu6";
				em_6.AttachTo = "menuItem3";
				em_6.StyleFolder = "styles/horizontal2";
				em_6.Width = "140";
				em_6.ShowEvent = MenuShowEvent.MouseOver;
				em_6.Align = MenuAlign.Right;
				em_6.OffsetVertical = 0;
				em_6.OffsetHorizontal = -4;
				em_6.AddItem(new MenuItem("menuItem31", "SubItem 1", "", "", "", "alert('Item 1 - SubItem 3 - SubItem 1')"));
				em_6.AddItem(new MenuItem("menuItem32", "SubItem 2", "", "", "", "alert('Item 1 - SubItem 3 - SubItem 2')"));
				em_6.AddItem(new MenuItem("menuItem33", "SubItem 3", "", "", "", "alert('Item 1 - SubItem 3 - SubItem 3')"));

				// add the submenus to the page
				placeHolder1.Controls.Add(em_1);
				placeHolder1.Controls.Add(em_2);
				placeHolder1.Controls.Add(em_4);
				placeHolder1.Controls.Add(em_5);
				placeHolder1.Controls.Add(em_6);
			}
		}
Example #8
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                // create the Parent EasyMenu
                mainEM = new EasyMenu();
                // set the ID (must be unique)
                mainEM.ID = "MainEM";
                // set the style for this menu
                mainEM.StyleFolder = "styles/vertical1";
                mainEM.Width       = "140";
                // show event is always so the menu is always visible
                // this menu doesn't require any AttachTo or Align properties set
                mainEM.ShowEvent = MenuShowEvent.Always;
                // display the menu vertically
                mainEM.Position = MenuPosition.Vertical;

                // the parent menu looks the same as the child menus so we don't need
                // to set different CSS classes names for its items or the menu

                // add the items for the menu
                mainEM.AddItem(new MenuItem("item1", "Item 1", "", "", "", ""));
                mainEM.AddItem(new MenuItem("item2", "Item 2", "", "", "", ""));
                mainEM.AddItem(new MenuItem("item3", "Item 3", "", "", "", ""));
                mainEM.AddItem(new MenuItem("item4", "Item 4", "", "", "", ""));
                mainEM.AddItem(new MenuItem("item5", "Item 5", "", "", "", ""));

                // add the menu to the placeholder on the page
                placeHolder1.Controls.Add(mainEM);


                // Create the submenus
                em_1    = new EasyMenu();
                em_1.ID = "Easymenu1";
                // this will attach to the first item of the parent menu (id=item1)
                em_1.AttachTo    = "item1";
                em_1.StyleFolder = "styles/vertical1";
                em_1.Width       = "140";
                // it will show on mouse over
                em_1.ShowEvent = MenuShowEvent.MouseOver;
                // and will align to the right of the item to which it is attached
                em_1.Align = MenuAlign.Right;
                // here are this menu's items
                em_1.AddItem(new MenuItem("menuItem1", "SubItem 1", "", "", "", "alert('Item 1 - SubItem 1')"));
                em_1.AddItem(new MenuItem("menuItem2", "SubItem 2", "", "", "", "alert('Item 1 - SubItem 2')"));
                em_1.AddItem(new MenuItem("menuItem3", "SubItem 3", "", "", "", "alert('Item 1 - SubItem 3')"));
                em_1.AddItem(new MenuItem("menuItem4", "SubItem 4", "", "", "", "alert('Item 1 - SubItem 4')"));
                em_1.AddItem(new MenuItem("menuItem5", "SubItem 5", "", "", "", "alert('Item 1 - SubItem 5')"));

                // and so on for every submenu
                em_2             = new EasyMenu();
                em_2.ID          = "Easymenu2";
                em_2.AttachTo    = "item2";
                em_2.StyleFolder = "styles/vertical1";
                em_2.Width       = "140";
                em_2.ShowEvent   = MenuShowEvent.MouseOver;
                em_2.Align       = MenuAlign.Right;
                em_2.AddItem(new MenuItem("menuItem6", "SubItem 1", "", "", "", "alert('Item 2 - SubItem 1')"));
                em_2.AddItem(new MenuItem("menuItem7", "SubItem 2", "", "", "", "alert('Item 2 - SubItem 2')"));
                em_2.AddItem(new MenuItem("menuItem8", "SubItem 3", "", "", "", "alert('Item 2 - SubItem 3')"));

                em_4             = new EasyMenu();
                em_4.ID          = "Easymenu4";
                em_4.AttachTo    = "item4";
                em_4.StyleFolder = "styles/vertical1";
                em_4.Width       = "140";
                em_4.ShowEvent   = MenuShowEvent.MouseOver;
                em_4.Align       = MenuAlign.Right;
                em_4.AddItem(new MenuItem("menuItem9", "SubItem 1", "", "", "", "alert('Item 4 - SubItem 1')"));
                em_4.AddItem(new MenuItem("menuItem10", "SubItem 2", "", "", "", "alert('Item 4 - SubItem 2')"));

                em_5             = new EasyMenu();
                em_5.ID          = "Easymenu5";
                em_5.AttachTo    = "item5";
                em_5.StyleFolder = "styles/vertical1";
                em_5.Width       = "140";
                em_5.ShowEvent   = MenuShowEvent.MouseOver;
                em_5.Align       = MenuAlign.Right;
                em_5.AddItem(new MenuItem("menuItem11", "SubItem 1", "", "", "", "alert('Item 5 - SubItem 1')"));
                em_5.AddItem(new MenuItem("menuItem12", "SubItem 2", "", "", "", "alert('Item 5 - SubItem 2')"));
                em_5.AddItem(new MenuItem("menuItem13", "SubItem 3", "", "", "", "alert('Item 5 - SubItem 3')"));
                em_5.AddItem(new MenuItem("menuItem14", "SubItem 4", "", "", "", "alert('Item 5 - SubItem 4')"));
                em_5.AddItem(new MenuItem("menuItem15", "SubItem 5", "", "", "", "alert('Item 5 - SubItem 5')"));

                em_6                  = new EasyMenu();
                em_6.ID               = "Easymenu6";
                em_6.AttachTo         = "menuItem3";
                em_6.StyleFolder      = "styles/vertical1";
                em_6.Width            = "140";
                em_6.ShowEvent        = MenuShowEvent.MouseOver;
                em_6.Align            = MenuAlign.Right;
                em_6.OffsetVertical   = 0;
                em_6.OffsetHorizontal = -4;
                em_6.AddItem(new MenuItem("menuItem31", "SubItem 1", "", "", "", "alert('Item 1 - SubItem 3 - SubItem 1')"));
                em_6.AddItem(new MenuItem("menuItem32", "SubItem 2", "", "", "", "alert('Item 1 - SubItem 3 - SubItem 2')"));
                em_6.AddItem(new MenuItem("menuItem33", "SubItem 3", "", "", "", "alert('Item 1 - SubItem 3 - SubItem 3')"));

                // add the submenus to the page
                placeHolder1.Controls.Add(em_1);
                placeHolder1.Controls.Add(em_2);
                placeHolder1.Controls.Add(em_4);
                placeHolder1.Controls.Add(em_5);
                placeHolder1.Controls.Add(em_6);
            }
        }
Example #9
0
    //
    // TODO: Add constructor logic here
    //
    public void PopulateStoreMenu2(EasyMenu ctrlMenu, EasyMenu[] ids)
    {
        //check if the product already exists in the cache
        System.Data.DataSet ds = (System.Data.DataSet)HttpContext.Current.Cache["MenuNavigation"];

        if (ds == null)
        {
            CategoryHelper categoryHelper = new CategoryHelper();
            ds = categoryHelper.GetNavigationItems(ZNodeConfigManager.SiteConfig.PortalID);

            //add the hierarchical relationship to the dataset
            ds.Relations.Add("NodeRelation", ds.Tables[0].Columns["CategoryId"], ds.Tables[0].Columns["ParentCategoryId"]);

            HttpContext.Current.Cache["MenuNavigation"] = ds;
        }
        System.Data.DataSet dsBrands = (System.Data.DataSet)HttpContext.Current.Cache["SubMenuBrands"];

        if (dsBrands == null)
        {
            GoOpticCategoryHelper gocategoryHelper = new GoOpticCategoryHelper();
            dsBrands = gocategoryHelper.GetBrands(ZNodeConfigManager.SiteConfig.PortalID);

            //add the hierarchical relationship to the dataset
            //dsBrands.Relations.Add("NodeRelation", ds.Tables[0].Columns["CategoryId"], ds.Tables[0].Columns["ParentCategoryId"]);

            HttpContext.Current.Cache["SubMenuBrands"] = dsBrands;
        }

        int CategoryNo = 0;
        foreach (DataRow dbRow in ds.Tables[0].Rows)
        {
            if (dbRow.IsNull("ParentCategoryID"))
            {
                if ((bool)dbRow["VisibleInd"])
                {
                    //create new menu item
                    // string itemText = dbRow["Name"].ToString();
                    int rows;
                    try
                    {
                        rows = Int32.Parse(dbRow["Rows"].ToString());
                    }
                    catch (Exception e)
                    { rows = 0; }
                    int columns;
                    try
                    {
                        columns = Int32.Parse(dbRow["Columns"].ToString());
                    }
                    catch (Exception e)
                    { columns = 0; }

                    string categoryId = dbRow["CategoryId"].ToString();
                    string seoURL = dbRow["SEOURL"].ToString();
                    string imageName=dbRow["ImageFile"].ToString();
                    string imageNameHOver = imageName.Replace(".","HOver.");
                    string imagePath = ZNode.Libraries.Framework.Business.ZNodeConfigManager.EnvironmentConfig.OriginalImagePath +imageName ;
                    imagePath = imagePath.Replace("~","");
                    string imagePathHOver = ZNode.Libraries.Framework.Business.ZNodeConfigManager.EnvironmentConfig.OriginalImagePath+imageNameHOver;
                    imagePathHOver = imagePathHOver.Replace("~", "");

                    string categoryText = dbRow["Name"].ToString();
                    if (categoryText.ToLower() == "home")
                        seoURL = "~/";
                    else
                        seoURL = ZNodeSEOUrl.MakeURL(categoryId, SEOUrlType.Category, seoURL);
                    imageName = imageName.Remove(imageName.IndexOf("."), imageName.Length - imageName.IndexOf("."));
                    string itemText = "<a href=\"" + seoURL.Replace("~","") + "\" onmouseover=\"roll_over('" + imageName + "', '" + imagePathHOver + "')\"  onmouseout=\"roll_over('" + imageName + "', '" + imagePath + "')\" ><img border=\"0\"  name =\"" + imageName + "\" src=\"" + imagePath + "\"/>";
                    //  itemText = itemText.Replace("default", imagePath);

                    categoryText = categoryText.Replace(" ", "");
                    string sepID = "sep" + categoryText;
                    string sepPath = "<img  src=\"~/Images/home/bete.png\"/>";
                    sepPath = sepPath.Replace("~", "");

                    if(CategoryNo!=0)
                        ctrlMenu.AddSeparator(sepID, sepPath);
                    OboutInc.EasyMenu_Pro.MenuItem mi = new OboutInc.EasyMenu_Pro.MenuItem(categoryText, itemText, "","", "", "");
                    ctrlMenu.AddItem(mi);

                    ids[CategoryNo].AttachTo = categoryText;
                    //recursively populate node
                    if (categoryText.ToLower() == "brands")
                    {
                        RecursivelyPopulateMenuBrands(ids[CategoryNo], rows, columns);
                    }
                    else
                    {
                        RecursivelyPopulateMenuSubCategory(dbRow, ids[CategoryNo], dsBrands, rows, columns);
                        // RecursivelyPopulateMenuBrands(ids[CategoryNo], categoryId, dsBrands);
                   }
                    CategoryNo++;
                }
            }
        }
    }
	private void BuildMenu1(OleDbDataReader oReader)
	{
		/*** main menu - records with ParentId = 0 ***/
		EasyMenu mainEM = null;
		/*** ***/
		
		/*** list with child menus ***/
		Hashtable childMenus = null;
		
		while (oReader.Read()) 
		{
			int parentId = oReader.GetInt32(1);
			if (parentId == 0)
			{
				if (mainEM == null)
				{
					mainEM = new EasyMenu();
					mainEM.ID = "mainEM";
					mainEM.StyleFolder = "styles/horizontal1";
					mainEM.Width = "400";
					mainEM.ShowEvent = MenuShowEvent.Always;
					mainEM.Position = MenuPosition.Horizontal;
					
					// css classes names for the menu and the item container
					mainEM.CSSMenu = "ParentMenu";
					mainEM.CSSMenuItemContainer = "ParentItemContainer";
					
					// css classes names for MenuItems
					CSSClasses MenuItemCssClasses = mainEM.CSSClassesCollection[mainEM.CSSClassesCollection.Add(new CSSClasses(typeof(OboutInc.EasyMenu_Pro.MenuItem)))];
					MenuItemCssClasses.ComponentSubMenuCellOver="ParentItemSubMenuCellOver";
					MenuItemCssClasses.ComponentContentCell="ParentItemContentCell";
					MenuItemCssClasses.Component="ParentItem";
					MenuItemCssClasses.ComponentSubMenuCell="ParentItemSubMenuCell";
					MenuItemCssClasses.ComponentIconCellOver="ParentItemIconCellOver";
					MenuItemCssClasses.ComponentIconCell="ParentItemIconCell";
					MenuItemCssClasses.ComponentOver="ParentItemOver";
					MenuItemCssClasses.ComponentContentCellOver="ParentItemContentCellOver";
					// add the classes names to the collection
					mainEM.CSSClassesCollection.Add(MenuItemCssClasses);
					
					// css classes names for MenuSeparators
					CSSClasses MenuSeparatorCssClasses = mainEM.CSSClassesCollection[mainEM.CSSClassesCollection.Add(new CSSClasses(typeof(MenuSeparator)))];
					MenuSeparatorCssClasses.ComponentSubMenuCellOver="ParentSeparatorSubMenuCellOver";
					MenuSeparatorCssClasses.ComponentContentCell="ParentSeparatorContentCell";
					MenuSeparatorCssClasses.Component="ParentSeparator";
					MenuSeparatorCssClasses.ComponentSubMenuCell="ParentSeparatorSubMenuCell";
					MenuSeparatorCssClasses.ComponentIconCellOver="ParentSeparatorIconCellOver";
					MenuSeparatorCssClasses.ComponentIconCell="ParentSeparatorIconCell";
					MenuSeparatorCssClasses.ComponentOver="ParentSeparatorOver";
					MenuSeparatorCssClasses.ComponentContentCellOver="ParentSeparatorContentCellOver";
					// add the classes names to the collection
					mainEM.CSSClassesCollection.Add(MenuSeparatorCssClasses);
				}
				
				mainEM.AddItem(new OboutInc.EasyMenu_Pro.MenuItem("item_" + oReader.GetInt32(0).ToString(), oReader.GetString(2), "", "", "", ""));

				placeHolder1.Controls.Add(mainEM);
			}
			else
			{
				if (childMenus == null)
					childMenus = new Hashtable();
				
				/* first time the menu is ceated */
				if (!childMenus.ContainsKey(parentId))
				{
					EasyMenu childEM = new EasyMenu();
					childEM.ID = "childEM_" + parentId;
					childEM.StyleFolder = "styles/horizontal1";
					childEM.ShowEvent = MenuShowEvent.MouseOver;
					childEM.AttachTo = "item_" + parentId;
					childEM.Width = "150";
					
					int menuLevel = oReader.GetInt32(3);
					if (menuLevel == 1)
						childEM.Align = MenuAlign.Under;
					else
						childEM.Align = MenuAlign.Left;
					
					childEM.AddItem(new OboutInc.EasyMenu_Pro.MenuItem("item_" + oReader.GetInt32(0).ToString(), oReader.GetString(2), "", "", "", ""));
					
					childMenus.Add(parentId, childEM);
					
					placeHolder1.Controls.Add(childEM);
				}
				/* items are added to the already created menu */
				else
				{
					EasyMenu childEM = (EasyMenu)childMenus[parentId];
					
					childEM.AddItem(new OboutInc.EasyMenu_Pro.MenuItem("item_" + oReader.GetInt32(0).ToString(), oReader.GetString(2), "", "", "", ""));
				}
			}
		}
	}
	private void BuildMenu2(OleDbDataReader oReader)
	{
		/*** main menu - records with ParentId = 0 ***/
		EasyMenu mainEM = null;
		/*** ***/
		
		/*** list with child menus ***/
		Hashtable childMenus = null;
		
		while (oReader.Read()) 
		{
			int parentId = oReader.GetInt32(1);
			if (parentId == 0)
			{
				if (mainEM == null)
				{
					mainEM = new EasyMenu();
					mainEM.ID = "VmainEM";
					mainEM.StyleFolder = "styles/horizontal1";
					mainEM.Width = "400";
					mainEM.ShowEvent = MenuShowEvent.Always;
					mainEM.Position = MenuPosition.Horizontal;
				}
				
				mainEM.AddItem(new OboutInc.EasyMenu_Pro.MenuItem("Vitem_" + oReader.GetInt32(0).ToString(), oReader.GetString(2), "", "", "", ""));

				placeHolder2.Controls.Add(mainEM);
			}
			else
			{
				if (childMenus == null)
					childMenus = new Hashtable();
				
				/* first time the menu is ceated */
				if (!childMenus.ContainsKey(parentId))
				{
					EasyMenu childEM = new EasyMenu();
					childEM.ID = "VchildEM_" + parentId;
					childEM.StyleFolder = "styles/horizontal1";
					childEM.ShowEvent = MenuShowEvent.MouseOver;
					childEM.AttachTo = "Vitem_" + parentId;
					childEM.Width = "150";
					
					int menuLevel = oReader.GetInt32(3);
					if (menuLevel == 1)
						childEM.Align = MenuAlign.Under;
					else
						childEM.Align = MenuAlign.Left;
					
					childEM.AddItem(new OboutInc.EasyMenu_Pro.MenuItem("Vitem_" + oReader.GetInt32(0).ToString(), oReader.GetString(2), "", "", "", ""));
					
					childMenus.Add(parentId, childEM);
					
					placeHolder1.Controls.Add(childEM);
				}
				/* items are added to the already created menu */
				else
				{
					EasyMenu childEM = (EasyMenu)childMenus[parentId];
					
					childEM.AddItem(new OboutInc.EasyMenu_Pro.MenuItem("Vitem_" + oReader.GetInt32(0).ToString(), oReader.GetString(2), "", "", "", ""));
				}
			}
		}
	}
Example #12
0
    private void Page_Load(object sender, System.EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            // EasymenuMain1
            EasymenuMain1.StyleFolder = "styles/style1_multiple_menus";
            EasymenuMain1.Width       = "330";
            EasymenuMain1.ShowEvent   = MenuShowEvent.Always;
            EasymenuMain1.Position    = MenuPosition.Horizontal;

            EasymenuMain1.AddItem(new MenuItem("item11", "Item 1", "", "", "", ""));
            EasymenuMain1.AddItem(new MenuItem("item12", "Item 2", "", "", "", ""));
            EasymenuMain1.AddItem(new MenuItem("item13", "Item 3", "", "", "", ""));
            EasymenuMain1.AddItem(new MenuItem("item14", "Item 4", "", "", "", ""));

            // EasymenuMain2
            EasymenuMain2.StyleFolder          = "styles/style2_multiple_menus";
            EasymenuMain2.Width                = "330";
            EasymenuMain2.ShowEvent            = MenuShowEvent.Always;
            EasymenuMain2.Position             = MenuPosition.Horizontal;
            EasymenuMain2.CSSMenu              = "easyMenu2";
            EasymenuMain2.CSSMenuItemContainer = "easyMenuItemContainer2";

            CSSClasses MenuItemCssClasses = EasymenuMain2.CSSClassesCollection[EasymenuMain2.CSSClassesCollection.Add(new CSSClasses(typeof(MenuItem)))];
            MenuItemCssClasses.ComponentSubMenuCellOver = "easyMenuItemSubMenuCellOver2";
            MenuItemCssClasses.ComponentContentCell     = "easyMenuItemContentCell2";
            MenuItemCssClasses.Component                = "easyMenuItem2";
            MenuItemCssClasses.ComponentSubMenuCell     = "easyMenuItemSubMenuCell2";
            MenuItemCssClasses.ComponentIconCellOver    = "easyMenuItemIconCellOver2";
            MenuItemCssClasses.ComponentIconCell        = "easyMenuItemIconCell2";
            MenuItemCssClasses.ComponentOver            = "easyMenuItemOver2";
            MenuItemCssClasses.ComponentContentCellOver = "easyMenuItemContentCellOver2";
            EasymenuMain2.CSSClassesCollection.Add(MenuItemCssClasses);

            CSSClasses MenuSeparatorCssClasses = EasymenuMain2.CSSClassesCollection[EasymenuMain2.CSSClassesCollection.Add(new CSSClasses(typeof(MenuSeparator)))];
            MenuSeparatorCssClasses.ComponentSubMenuCellOver = "easyMenuSeparatorSubMenuCellOver2";
            MenuSeparatorCssClasses.ComponentContentCell     = "easyMenuSeparatorContentCell2";
            MenuSeparatorCssClasses.Component                = "easyMenuSeparator2";
            MenuSeparatorCssClasses.ComponentSubMenuCell     = "easyMenuSeparatorSubMenuCell2";
            MenuSeparatorCssClasses.ComponentIconCellOver    = "easyMenuSeparatorIconCellOver2";
            MenuSeparatorCssClasses.ComponentIconCell        = "easyMenuSeparatorIconCell2";
            MenuSeparatorCssClasses.ComponentOver            = "easyMenuSeparatorOver2";
            MenuSeparatorCssClasses.ComponentContentCellOver = "easyMenuSeparatorContentCellOver2";
            EasymenuMain2.CSSClassesCollection.Add(MenuSeparatorCssClasses);

            EasymenuMain2.AddItem(new MenuItem("item21", "Item 1", "", "", "", ""));
            EasymenuMain2.AddItem(new MenuItem("item22", "Item 2", "", "", "", ""));
            EasymenuMain2.AddItem(new MenuItem("item23", "Item 3", "", "", "", ""));
            EasymenuMain2.AddItem(new MenuItem("item24", "Item 4", "", "", "", ""));

            // Easymenu11
            Easymenu11.AttachTo    = "item11";
            Easymenu11.StyleFolder = "styles/style1_multiple_menus";
            Easymenu11.Width       = "140";
            Easymenu11.ShowEvent   = MenuShowEvent.MouseOver;
            Easymenu11.Align       = MenuAlign.Under;
            Easymenu11.AddItem(new MenuItem("menuItem111", "Item11", "", "", "", ""));
            Easymenu11.AddItem(new MenuItem("menuItem112", "Item12", "", "", "", ""));
            Easymenu11.AddItem(new MenuItem("menuItem113", "Item13", "", "", "", ""));

            // Easymenu12
            Easymenu12.AttachTo    = "item12";
            Easymenu12.StyleFolder = "styles/style1_multiple_menus";
            Easymenu12.Width       = "140";
            Easymenu12.ShowEvent   = MenuShowEvent.MouseOver;
            Easymenu12.Align       = MenuAlign.Under;
            Easymenu12.AddItem(new MenuItem("menuItem121", "Item21", "", "", "", ""));
            Easymenu12.AddItem(new MenuItem("menuItem122", "Item22", "", "", "", ""));

            // Easymenu13
            Easymenu13.AttachTo    = "item13";
            Easymenu13.StyleFolder = "styles/style1_multiple_menus";
            Easymenu13.Width       = "140";
            Easymenu13.ShowEvent   = MenuShowEvent.MouseOver;
            Easymenu13.Align       = MenuAlign.Under;
            Easymenu13.AddItem(new MenuItem("menuItem131", "Item31", "", "", "", ""));
            Easymenu13.AddItem(new MenuItem("menuItem132", "Item32", "", "", "", ""));
            Easymenu13.AddItem(new MenuItem("menuItem133", "Item33", "", "", "", ""));
            Easymenu13.AddItem(new MenuItem("menuItem134", "Item34", "", "", "", ""));
            Easymenu13.AddItem(new MenuItem("menuItem135", "Item35", "", "", "", ""));
            Easymenu13.AddItem(new MenuItem("menuItem136", "Item36", "", "", "", ""));

            // Easymenu14
            Easymenu14.AttachTo    = "item14";
            Easymenu14.StyleFolder = "styles/style1_multiple_menus";
            Easymenu14.Width       = "140";
            Easymenu14.ShowEvent   = MenuShowEvent.MouseOver;
            Easymenu14.Align       = MenuAlign.Under;
            Easymenu14.AddItem(new MenuItem("menuItem141", "Item41", "", "", "", ""));
            Easymenu14.AddItem(new MenuItem("menuItem142", "Item42", "", "", "", ""));
            Easymenu14.AddItem(new MenuItem("menuItem143", "Item43", "", "", "", ""));

            // Easymenu21
            Easymenu21.AttachTo    = "item21";
            Easymenu21.StyleFolder = "styles/style1_multiple_menus";
            Easymenu21.Width       = "140";
            Easymenu21.ShowEvent   = MenuShowEvent.MouseOver;
            Easymenu21.Align       = MenuAlign.Under;
            Easymenu21.AddItem(new MenuItem("menuItem211", "Item11", "", "", "", ""));
            Easymenu21.AddItem(new MenuItem("menuItem212", "Item12", "", "", "", ""));
            Easymenu21.AddItem(new MenuItem("menuItem213", "Item13", "", "", "", ""));

            // Easymenu22
            Easymenu22.AttachTo    = "item22";
            Easymenu22.StyleFolder = "styles/style1_multiple_menus";
            Easymenu22.Width       = "140";
            Easymenu22.ShowEvent   = MenuShowEvent.MouseOver;
            Easymenu22.Align       = MenuAlign.Under;
            Easymenu22.AddItem(new MenuItem("menuItem221", "Item21", "", "", "", ""));

            // Easymenu23
            Easymenu23.AttachTo    = "item23";
            Easymenu23.StyleFolder = "styles/style1_multiple_menus";
            Easymenu23.Width       = "140";
            Easymenu23.ShowEvent   = MenuShowEvent.MouseOver;
            Easymenu23.Align       = MenuAlign.Under;
            Easymenu23.AddItem(new MenuItem("menuItem231", "Item31", "", "", "", ""));
            Easymenu23.AddItem(new MenuItem("menuItem232", "Item32", "", "", "", ""));
            Easymenu23.AddItem(new MenuItem("menuItem233", "Item33", "", "", "", ""));
            Easymenu23.AddItem(new MenuItem("menuItem234", "Item34", "", "", "", ""));

            // Easymenu24
            Easymenu24.AttachTo    = "item24";
            Easymenu24.StyleFolder = "styles/style1_multiple_menus";
            Easymenu24.Width       = "140";
            Easymenu24.ShowEvent   = MenuShowEvent.MouseOver;
            Easymenu24.Align       = MenuAlign.Under;
            Easymenu24.AddItem(new MenuItem("menuItem241", "Item41", "", "", "", ""));
            Easymenu24.AddItem(new MenuItem("menuItem242", "Item42", "", "", "", ""));
            Easymenu24.AddItem(new MenuItem("menuItem243", "Item43", "", "", "", ""));
        }
    }
		private void Page_Load(object sender, System.EventArgs e)
		{
			if (!Page.IsPostBack)
			{
				// create the Parent EasyMenu
				mainEM = new EasyMenu();
				// set the ID (must be unique)
				mainEM.ID = "MainEM";
				// set the style for this menu
				mainEM.StyleFolder = "styles/vertical1";
				mainEM.Width = "140";
				// show event is always so the menu is always visible
				// this menu doesn't require any AttachTo or Align properties set
				mainEM.ShowEvent = MenuShowEvent.Always;
				// display the menu vertically
				mainEM.Position = MenuPosition.Vertical;

				// the parent menu looks the same as the child menus so we don't need 
				// to set different CSS classes names for its items or the menu

				// add the items for the menu
				mainEM.AddItem(new MenuItem("item1", "Item 1", "", "", "", ""));
				mainEM.AddItem(new MenuItem("item2", "Item 2", "", "", "", ""));
				mainEM.AddItem(new MenuItem("item3", "Item 3", "", "", "", ""));
				mainEM.AddItem(new MenuItem("item4", "Item 4", "", "", "", ""));
				mainEM.AddItem(new MenuItem("item5", "Item 5", "", "", "", ""));

				// add the menu to the placeholder on the page
				placeHolder1.Controls.Add(mainEM);


				// Create the submenus
				em_1 = new EasyMenu();
				em_1.ID = "Easymenu1";
				// this will attach to the first item of the parent menu (id=item1)
				em_1.AttachTo = "item1";
				em_1.StyleFolder = "styles/vertical1";
				em_1.Width = "140";
				// it will show on mouse over
				em_1.ShowEvent = MenuShowEvent.MouseOver;
				// and will align to the right of the item to which it is attached
				em_1.Align = MenuAlign.Right;
				// here are this menu's items
				em_1.AddItem(new MenuItem("menuItem1", "SubItem 1", "", "", "", "alert('Item 1 - SubItem 1')"));
				em_1.AddItem(new MenuItem("menuItem2", "SubItem 2", "", "", "", "alert('Item 1 - SubItem 2')"));
				em_1.AddItem(new MenuItem("menuItem3", "SubItem 3", "", "", "", "alert('Item 1 - SubItem 3')"));
				em_1.AddItem(new MenuItem("menuItem4", "SubItem 4", "", "", "", "alert('Item 1 - SubItem 4')"));
				em_1.AddItem(new MenuItem("menuItem5", "SubItem 5", "", "", "", "alert('Item 1 - SubItem 5')"));

				// and so on for every submenu
				em_2 = new EasyMenu();
				em_2.ID = "Easymenu2";
				em_2.AttachTo = "item2";
				em_2.StyleFolder = "styles/vertical1";
				em_2.Width = "140";
				em_2.ShowEvent = MenuShowEvent.MouseOver;
				em_2.Align = MenuAlign.Right;
				em_2.AddItem(new MenuItem("menuItem6", "SubItem 1", "", "", "", "alert('Item 2 - SubItem 1')"));
				em_2.AddItem(new MenuItem("menuItem7", "SubItem 2", "", "", "", "alert('Item 2 - SubItem 2')"));
				em_2.AddItem(new MenuItem("menuItem8", "SubItem 3", "", "", "", "alert('Item 2 - SubItem 3')"));

				em_4 = new EasyMenu();
				em_4.ID = "Easymenu4";
				em_4.AttachTo = "item4";
				em_4.StyleFolder = "styles/vertical1";
				em_4.Width = "140";
				em_4.ShowEvent = MenuShowEvent.MouseOver;
				em_4.Align = MenuAlign.Right;
				em_4.AddItem(new MenuItem("menuItem9", "SubItem 1", "", "", "", "alert('Item 4 - SubItem 1')"));
				em_4.AddItem(new MenuItem("menuItem10", "SubItem 2", "", "", "", "alert('Item 4 - SubItem 2')"));

				em_5 = new EasyMenu();
				em_5.ID = "Easymenu5";
				em_5.AttachTo = "item5";
				em_5.StyleFolder = "styles/vertical1";
				em_5.Width = "140";
				em_5.ShowEvent = MenuShowEvent.MouseOver;
				em_5.Align = MenuAlign.Right;
				em_5.AddItem(new MenuItem("menuItem11", "SubItem 1", "", "", "", "alert('Item 5 - SubItem 1')"));
				em_5.AddItem(new MenuItem("menuItem12", "SubItem 2", "", "", "", "alert('Item 5 - SubItem 2')"));
				em_5.AddItem(new MenuItem("menuItem13", "SubItem 3", "", "", "", "alert('Item 5 - SubItem 3')"));
				em_5.AddItem(new MenuItem("menuItem14", "SubItem 4", "", "", "", "alert('Item 5 - SubItem 4')"));
				em_5.AddItem(new MenuItem("menuItem15", "SubItem 5", "", "", "", "alert('Item 5 - SubItem 5')"));

				em_6 = new EasyMenu();
				em_6.ID = "Easymenu6";
				em_6.AttachTo = "menuItem3";
				em_6.StyleFolder = "styles/vertical1";
				em_6.Width = "140";
				em_6.ShowEvent = MenuShowEvent.MouseOver;
				em_6.Align = MenuAlign.Right;
				em_6.OffsetVertical = 0;
				em_6.OffsetHorizontal = -4;
				em_6.AddItem(new MenuItem("menuItem31", "SubItem 1", "", "", "", "alert('Item 1 - SubItem 3 - SubItem 1')"));
				em_6.AddItem(new MenuItem("menuItem32", "SubItem 2", "", "", "", "alert('Item 1 - SubItem 3 - SubItem 2')"));
				em_6.AddItem(new MenuItem("menuItem33", "SubItem 3", "", "", "", "alert('Item 1 - SubItem 3 - SubItem 3')"));

				// add the submenus to the page
				placeHolder1.Controls.Add(em_1);
				placeHolder1.Controls.Add(em_2);
				placeHolder1.Controls.Add(em_4);
				placeHolder1.Controls.Add(em_5);
				placeHolder1.Controls.Add(em_6);
			}
		}