Hi,
I have an ASP.Net Grid with rows in it. Depending on the type of row being right-clicked upon I want to show a different ContextMenu.
The contents of this ContextMenu should be computed server-side. My client-side code is below:
Server side the command showContextmenu creates a new RadMenuItemCollection and assigns this reference to the RadContextMenu. Then this RadContextMenu is updated. However when the menu.show() is called client-side the ContextMenu appears and then immediately disappears.
How can I accomplish dynamic loading of a RadContextMenu on a row in a Grid?
I have an ASP.Net Grid with rows in it. Depending on the type of row being right-clicked upon I want to show a different ContextMenu.
The contents of this ContextMenu should be computed server-side. My client-side code is below:
| /* this.aspGrid.ClientSettings.ClientEvents.OnRowContextMenu is set to JavaScript like below: */ |
| function(grid, row) { |
| var menu = $find('contextMenu'); |
| var evt = row.get_domEvent(); |
| if ((!evt.relatedTarget) || (!$telerik.isDescendantOrSelf(menu.get_element(), evt.relatedTarget))) { |
| window.setTimeout( |
| function() { |
| alert(123123); |
| grid.get_masterTableView().fireCommand('showContextmenu', row.get_itemIndexHierarchical()); |
| menu.show( evt ); |
| }, |
| 0); |
| } |
| } |
Server side the command showContextmenu creates a new RadMenuItemCollection and assigns this reference to the RadContextMenu. Then this RadContextMenu is updated. However when the menu.show() is called client-side the ContextMenu appears and then immediately disappears.
How can I accomplish dynamic loading of a RadContextMenu on a row in a Grid?