Example #1
0
 public void AddChild(ItemEX item)
 {
     if (this.PrimaryCollection as Infragistics.WebUI.UltraWebListbar.Items != null)
     {
         Infragistics.WebUI.UltraWebListbar.Items items = ((Infragistics.WebUI.UltraWebListbar.Items) this.PrimaryCollection);
         int offset = 0;
         for (int i = this.Index; i < items.Count; i++)
         {
             if (((ItemEX)items[i]).ParentItem == this)
             {
                 offset++;
             }
         }
         items.Insert(this.Index + offset + 1, item);
     }
 }
Example #2
0
    private void GetMenuAdd(DataRow drMenu)
    {
        int    MENU_REF_ID  = 0;
        int    UP_MENU_ID   = 0;
        int    ROOT_MENU_ID = 0;
        string Menu_Name    = Convert.ToString(drMenu["Menu_Name"]);

        if (drMenu["MENU_REF_ID"] != DBNull.Value)
        {
            MENU_REF_ID = (int)(drMenu["MENU_REF_ID"]);
        }
        if (drMenu["UP_MENU_ID"] != DBNull.Value)
        {
            UP_MENU_ID = (int)(drMenu["UP_MENU_ID"]);
        }
        if (drMenu["UP_MENU_ID"] != DBNull.Value)
        {
            ROOT_MENU_ID = (int)(drMenu["UP_MENU_ID"]);
        }

        DataRow drRootParent = drMenu;

        if (drRootParent.GetParentRow("MenuRelation") != null)
        {
            drRootParent = drRootParent.GetParentRow("MenuRelation");
        }
        if (drRootParent["UP_MENU_ID"] != DBNull.Value)
        {
            ROOT_MENU_ID = Convert.ToInt32(drRootParent["UP_MENU_ID"]);
        }

        Infragistics.WebUI.UltraWebListbar.Group ownerGroup = wb.Groups.FromKey(ROOT_MENU_ID.ToString());

        try
        {
            if (ownerGroup != null)
            {
                Menu_Name = Convert.ToString(drMenu["Menu_Name"]);
                string theRunningSampleURL = Convert.ToString(drMenu["MENU_FULL_PATH"]);

                ItemEX ownerItem = ownerGroup.Items.FromKey(UP_MENU_ID.ToString()) as ItemEX;

                if (ownerItem != null)
                {
                    ItemEX theListBarItem;

                    theListBarItem             = new ItemEX();
                    theListBarItem.Text        = Menu_Name;
                    theListBarItem.Tag         = theRunningSampleURL;
                    theListBarItem.Key         = theRunningSampleURL;
                    theListBarItem.TargetUrl   = theRunningSampleURL;
                    theListBarItem.TargetFrame = "frMain";
                    theListBarItem.Align       = "left";
                    theListBarItem.DefaultStyle.Padding.Left     = 15;
                    ownerGroup.DefaultItemStyle.Cursor           = Infragistics.WebUI.Shared.Cursors.Hand;
                    ownerGroup.DefaultItemHoverStyle.BorderStyle = BorderStyle.None;
                    ownerItem.AddChild(theListBarItem);
                }
                else
                {
                    ItemEX theListBarItem;

                    theListBarItem       = new ItemEX();
                    theListBarItem.Text  = Menu_Name;
                    theListBarItem.Key   = MENU_REF_ID.ToString();//theSampleDescription;
                    theListBarItem.Align = "left";
                    theListBarItem.DefaultStyle.Font.Bold   = true;
                    theListBarItem.DefaultStyle.Padding.Top = Unit.Pixel(PRODUCT_SPACING);
                    ownerGroup.Items.Add(theListBarItem);
                }
            }
        }
        catch (NullReferenceException e) { }
    }