Databound menu and separator

2 posts, 0 answers
  1. neebs
    neebs avatar
    106 posts
    Member since:
    Apr 2007

    Posted 02 Mar 2010 Link to this post

    Hi, I am generating a menu in code using a data schema I have defined for this purpose. All works well, but I'm having trouble making the separator appear. I'm trying to do this in the ItemDatabound method. The result is that the menu displays with the separator occupying space, but no horizontal line appears. The code is below, you can ignore the menu access code, the first part of the method is where this happens. Note: menu item text of a single dash "-" indicates that the item is a separator. I'm using the Default skin.

        protected void RadMenuIW_ItemDataBound(object sender, RadMenuEventArgs e) 
        { 
            IntranetMenuInfo item = (IntranetMenuInfo)e.Item.DataItem; 
            e.Item.Visible = (item.Hidden == null) || !((bool) item.Hidden); 
            e.Item.Enabled = (item.Disabled == null) || !((bool) item.Disabled); 
            bool restricted = (item.RestrictedByGroup != null) && ((bool)item.RestrictedByGroup); 
            bool pagespecific = (item.PageSpecific != null) && ((bool)item.PageSpecific); 
     
            if (item.ItemText == "-"
            { 
                e.Item.IsSeparator = true
                e.Item.Text = ""
            } 
     
            if ((e.Item.Visible) && restricted) 
            { 
                bool hide = true
                // Might be hidden from user 
                foreach (UserGroupInfo groupInfo in mUserInfo.UsersGroups) 
                { 
                    if (item.MenuUserGroupExists(groupInfo.UserGroupName)) 
                    { 
                        hide = false
                        break
                    } 
                } 
     
                e.Item.Visible = !hide; 
            } 
     
            if (pagespecific) 
            { 
                string pagename = GetCurrentPageName(); 
     
                IntranetMenuPageInfo pageInfo = 
                    IntranetMenuPageData.GetPage(item.Id, pagename); 
                if (pageInfo != null
                { 
                    if ((pageInfo.RestrictByGroup != null) && ((bool)pageInfo.RestrictByGroup)) 
                    { 
                        e.Item.Visible = false
                        foreach (UserGroupInfo groupInfo in mUserInfo.UsersGroups) 
                        { 
                            if (pageInfo.PageUserGroupExists(groupInfo.UserGroupName)) 
                            { 
                                e.Item.Visible = true
                                break
                            } 
                        } 
                    } 
                    else 
                    { 
                        e.Item.Visible = (item.MenuPageExists(pagename)); 
                    } 
                } 
                else 
                { 
                    e.Item.Visible = false
                } 
     
            } 
        } 
     


    Thanks, STeve
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 05 Mar 2010 Link to this post

    Hi Neebs,

    Thank you for reporting this problem. It is indeed a bug with the Default skin. I have logged it and we will fix it shortly. Meanwhile, you can use the following css workaround:
    .rmSeparator .rmText
       {
           border-bottom: solid 1px black !important;    
       }


    Regards,
    Peter
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top