This is a migrated thread and some comments may be shown as answers.

Databound menu and separator

1 Answer 85 Views
Menu
This is a migrated thread and some comments may be shown as answers.
neebs
Top achievements
Rank 2
neebs asked on 02 Mar 2010, 08:36 PM
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

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 05 Mar 2010, 04:45 PM
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.
Tags
Menu
Asked by
neebs
Top achievements
Rank 2
Answers by
Peter
Telerik team
Share this question
or