I am facing an issue with my radmenu (Telerik control) where I want it to perform two actions when clicked: 1. open menu, 2. cancel postback.
Below is the code for the menu:
<telerik:RadMenu ID="radMnu1" runat="server" ClickToOpen="true" OnClientItemClicked="MenuItemClicked" OnClientItemClicking="MenuItemClickingCancelPostback">
<Items>...
</Items>
</telerik:RadMenuItem>
Here are the associated JavaScript methods:
function MenuItemClicked(sender, args) {
var itemValue = args.get_item().get_value();
var menu = $find("ctl00_radMnu1");
var menuItem = menu.findItemByText(itemText);
if (menuItem) menuItem.open();
}
function MenuItemClickingCancelPostback(sender, args) {
args.set_cancel(true); // Cancel the postback
}
The problem arises when I enable the OnItemClicking event - it cancels the postback but fails to trigger the OnItemClicked event. Conversely, disabling OnItemClicking results in a successful menu opening but also triggers a postback.
Is there a way to achieve both: opening the menu and cancelling the postback? Ideally, I would like to cancel the postback in the OnItemClicked event, but unfortunately, the set_cancel() method is not available in its arguments.
Any guidance on this matter would be greatly appreciated.