I am trying to cancel the postback of an onItemClick command inside of an onClientItemClick command.
The javascript runs properly as I get the alert but the post back still occurs even though the function returned false.
I have also tried changing the OnClientItemClicked to "return onMenuItemClicked();" but this breaks the RadContextMenu all together and I get errors on the page due to improper syntax.
I have also tried adding "window.event.returnValue = false;" to the javascript but have also had no luck with that.
Any help would be greatly appreciated.
| <script type="text/javascript"> |
| function onMenuItemClicked(sender, eventArgs) { |
| alert("Testing"); |
| return false; |
| } |
| </script> |
| <telerik:RadContextMenu ID="menuContextMenu" runat="server" OnClientItemClicked="onMenuItemClicked" |
| onitemclick="menuContextMenu_ItemClick"> |
| <Items> |
| <telerik:RadMenuItem Text="Add Sub Menu" Value="1"></telerik:RadMenuItem> |
| <telerik:RadMenuItem Text="Remove" Value="2"></telerik:RadMenuItem> |
| </Items> |
| <Targets> |
| <telerik:ContextMenuTagNameTarget TagName="menuNode" /> |
| </Targets> |
| </telerik:RadContextMenu> |
The javascript runs properly as I get the alert but the post back still occurs even though the function returned false.
I have also tried changing the OnClientItemClicked to "return onMenuItemClicked();" but this breaks the RadContextMenu all together and I get errors on the page due to improper syntax.
I have also tried adding "window.event.returnValue = false;" to the javascript but have also had no luck with that.
Any help would be greatly appreciated.