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