Hello. I have a RadContextMenu attached to a RadGrid. The issue is that the RadContextMenu is going to have different items in it based on the security level under which the user is signed in. I already have this working. I have an OnRowContextMenu event that calls a client side function wirtten in JavaScript. As you can see below, I am successfully adding items based on the user's security level. My question is that I want to add a separator between two menu items. The IsSeparator property works fine in the XML, but I can't get it working when I am adding the menu items on the client side.
This is what I want the context menu to look like:
View Details
----------------
Add
Thanks in advance for the help.
-------------------------------------------------------
ANOTHER QUESTION: Is there way to clear all the items out on the client side. As it stands now, every time I go into the function all the menu items are being added again and again, growing the list. On the server side, I can do: RadMenu.Items.Clear() but so far I have been unable to find a way to do this on the client side.
function RowContextMenu(sender, eventArgs) { var menu; menu = $find("<%=RadMenu.ClientID %>");
// Set securityLevelLabel to be a hidden field set elsewhere, code deleted for clarity
// Add items to the context menu based on the security level of the user if (securityLevelLabel.innerText == "view") { // Look at next block for example } else if (securityLevelLabel.innerText == "normal") { var menuItem = new Telerik.Web.UI.RadMenuItem(); menuItem.set_text("View Details"); menu.trackChanges(); menu.get_items().add(menuItem); // ***** I WANT A SEPARATOR HERE ********** menuItem = new Telerik.Web.UI.RadMenuItem(); menuItem.set_text("Add"); menu.trackChanges(); menu.get_items().add(menuItem); menu.commitChanges(); } else { // Code deleted for clarity } }This is what I want the context menu to look like:
View Details
----------------
Add
Thanks in advance for the help.
-------------------------------------------------------
ANOTHER QUESTION: Is there way to clear all the items out on the client side. As it stands now, every time I go into the function all the menu items are being added again and again, growing the list. On the server side, I can do: RadMenu.Items.Clear() but so far I have been unable to find a way to do this on the client side.