This is a migrated thread and some comments may be shown as answers.

Item posting back, still remains selected

1 Answer 85 Views
Menu
This is a migrated thread and some comments may be shown as answers.
20Below
Top achievements
Rank 1
20Below asked on 13 May 2011, 05:33 AM
Hi,
I have some menu items that post back but I don't want them to stay selected. Are they supposed to stay selected then we have to manually deselect them? I saw that another user had an issue with databound controls but I am not doing that.  What I'd like to do is have some menuitems stay selected on postback and some to not stay selected. Example, if there is a menu item named "Save" I don't want it to stay selected after postback and the save functionality is executed. However, let's say I have a menu item that sets a property true/false like say "Bold", I want that to stay selected on postback. Any advice would be appreciated.
Thanks,
G

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 13 May 2011, 07:16 AM
Hello,

Here is the code that I tried to overcome this behavior of RadMenu when an item is selected. Hope this helps you.

aspx:
<telerik:RadMenu ID="menu" runat="server"  onitemclick="menu_ItemClick">
 <Items>
       <telerik:RadMenuItem runat="server" Text="save" >
       </telerik:RadMenuItem>
       <telerik:RadMenuItem runat="server" Text="cancel" >
       </telerik:RadMenuItem>
       <telerik:RadMenuItem runat="server" Text="saveas" >
       </telerik:RadMenuItem>
 </Items>
</
telerik:RadMenu>

C#:
if (IsPostBack)
 {
  foreach (RadMenuItem item in menu.GetAllItems())
   {
    if (item.Selected)
  item.Selected = false;
   }
 }

Thanks,
Princy.
Tags
Menu
Asked by
20Below
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or