Hello,
I'm currently prototyping a menu where I want a child menu item to make an Ajax call, alter the Image on the parent menu, and then close the parent menu. Here is my menu:
I use the OnClientItemClicked event currently just to check the item being clicked, toggle the images, and close the menu. There's no Ajax involvement yet.
This works, except that immediately after the menu closes, it opens again. As you can see, I've tried a few different things. I've closed it, blurred it, un-selected it, and in various different orders. I've done this by referencing both "sender" and "CurrentTopicMenuItem", which I programmatically set to the parent menu item. None of them do the trick. The menu always closes and then immediately opens again.
(Note that <%= Application("ApplicationPath") %> is just a way to reference the root of the web since it can vary from development to production.)
Can you help?
I'm currently prototyping a menu where I want a child menu item to make an Ajax call, alter the Image on the parent menu, and then close the parent menu. Here is my menu:
<Telerik:RadMenu ID="Menu_gob" runat="server" Skin="Default" OnClientItemClicked="MenuItemClicked"> |
<Items> |
<Telerik:RadMenuItem Value="AllTopics" Text="Top/All Topics" /> |
<Telerik:RadMenuItem Value="CurrentTopic" Text="Page Lifecycle" ImageUrl="~/CABS_Images/Icon_NotSubscribed.png"> |
<Items> |
<Telerik:RadMenuItem Value="CurrentTopicNewThread" Text="Start a New Thread" ImageUrl="~/CABS_Images/Icon_NewDocument.png" /> |
<Telerik:RadMenuItem Value="CurrentTopicSubscription" Text="Turn ON Notifications" ImageUrl="~/CABS_Images/Icon_Subscribed.png" /> |
</Items> |
</Telerik:RadMenuItem> |
<Telerik:RadMenuItem Value="CurrentThread" Text="NEW THREAD, 2, 3, 4..." ImageUrl="~/CABS_Images/Icon_Subscribed.png"> |
<Items> |
<Telerik:RadMenuItem Value="CurrentThreadNewPost" Text="Post a Reply" ImageUrl="~/CABS_Images/Icon_NewDocument.png" /> |
<Telerik:RadMenuItem Value="CurrentThreadSubscription" Text="Turn OFF Notifications" ImageUrl="~/CABS_Images/Icon_NotSubscribed.png" /> |
</Items> |
</Telerik:RadMenuItem> |
<Telerik:RadMenuItem Value="NewPost" Text="Post a Reply" ImageUrl="~/CABS_Images/Icon_NewDocument.png" /> |
<Telerik:RadMenuItem Value="CannotPost" Text="This Thread is Read-Only" ImageUrl="~/CABS_Images/Icon_CannotPost.png" /> |
</Items> |
</Telerik:RadMenu> |
I use the OnClientItemClicked event currently just to check the item being clicked, toggle the images, and close the menu. There's no Ajax involvement yet.
<script language="javascript" type="text/javascript"> |
var subbed_gbl = false; |
function MenuItemClicked(sender, args) { |
var clickedMenuItem = args.get_item(); |
if (clickedMenuItem.get_value() == 'CurrentTopicSubscription') { |
var CurrentTopicMenuItem = $find("<%= Menu_gob.ClientID %>").findItemByValue('CurrentTopic'); |
subbed_gbl = !subbed_gbl; |
if (subbed_gbl) { |
clickedMenuItem.set_imageUrl('<%= Application("ApplicationPath") %>/CABS_Images/Icon_NotSubscribed.png'); |
clickedMenuItem.set_text('Turn Off Notifications'); |
CurrentTopicMenuItem.set_imageUrl('<%= Application("ApplicationPath") %>/CABS_Images/Icon_Subscribed.png'); |
} else { |
clickedMenuItem.set_imageUrl('<%= Application("ApplicationPath") %>/CABS_Images/Icon_Subscribed.png'); |
clickedMenuItem.set_text('Turn On Notifications'); |
CurrentTopicMenuItem.set_imageUrl('<%= Application("ApplicationPath") %>/CABS_Images/Icon_NotSubscribed.png'); |
} |
// CurrentTopicMenuItem.blur(); |
// CurrentTopicMenuItem.set_selected(false); |
// CurrentTopicMenuItem.close(); |
sender.close(); |
} |
} |
</script> |
This works, except that immediately after the menu closes, it opens again. As you can see, I've tried a few different things. I've closed it, blurred it, un-selected it, and in various different orders. I've done this by referencing both "sender" and "CurrentTopicMenuItem", which I programmatically set to the parent menu item. None of them do the trick. The menu always closes and then immediately opens again.
(Note that <%= Application("ApplicationPath") %> is just a way to reference the root of the web since it can vary from development to production.)
Can you help?