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

ContextMenu not visible after OnAjaxRequest

1 Answer 58 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Navnit
Top achievements
Rank 1
Navnit asked on 05 Dec 2012, 05:48 AM
Hi,

I am attaching a Contextmenu to Listview. This is 2 level composite Context menu (contextmenu.jpg). Below is my source for building Contextmenu

<telerik:RadContextMenu ID="RadMenu1" runat="server" EnableRoundedCorners="true" EnableShadows="true" OnClientShowing="LoadContextMenu">
           <Items>
               <telerik:RadMenuItem Text="Accounting">
                   <Items>
                       <telerik:RadMenuItem Text="Sub Menu">
                           <ItemTemplate>
                               <telerik:RadTextBox ID="txtDecimal" Text="2" Label="Decimals" runat="server" Width="70px"
                                   MaxLength="2">
                               </telerik:RadTextBox>
                               <telerik:RadListBox ID="rlbcm1" runat="server" CheckBoxes="true">
                                   <Items>
                                       <telerik:RadListBoxItem Text="Include Commas" Value="Include Commas" />
                                       <telerik:RadListBoxItem Text="Include $ Sign" Value="Include $ Sign" />
                                   </Items>
                               </telerik:RadListBox>
                               <b>Negative Number</b>
                               <asp:RadioButtonList ID="rbNegativeNumber" runat="server" RepeatDirection="Vertical">
                                   <asp:ListItem Text="Use Brackets" Value="1"></asp:ListItem>
                                   <asp:ListItem Text="Use Negative Number" Value="2"></asp:ListItem>
                               </asp:RadioButtonList>
                           </ItemTemplate>
                       </telerik:RadMenuItem>
                   </Items>
               </telerik:RadMenuItem>
               <telerik:RadMenuItem Text="Date">
                   <Items>
                       <telerik:RadMenuItem Text="Sub Menu">
                           <ItemTemplate>
                               <asp:RadioButtonList ID="rbDateFormat" runat="server" RepeatDirection="Vertical">
                                   <asp:ListItem Text="01/05/2012" Value="1"></asp:ListItem>
                                   <asp:ListItem Text="Jan 05, 2012" Value="2"></asp:ListItem>
                                   <asp:ListItem Text="2012-01-05" Value="3"></asp:ListItem>
                                   <asp:ListItem Text="Custom" Value="4"></asp:ListItem>
                               </asp:RadioButtonList>
                           </ItemTemplate>
                       </telerik:RadMenuItem>
                   </Items>
               </telerik:RadMenuItem>
               <telerik:RadMenuItem Text="Percentage">
                   <Items>
                       <telerik:RadMenuItem Text="Sub Menu">
                           <ItemTemplate>
                               <telerik:RadTextBox ID="txtPercentageDecimal" Text="2" Label="Decimals" runat="server"
                                   Width="70px" MaxLength="2">
                               </telerik:RadTextBox>
                               <telerik:RadListBox ID="rlbpercentage" runat="server" CheckBoxes="true">
                                   <Items>
                                       <telerik:RadListBoxItem Text="% symbol" Value="% symbol" />
                                   </Items>
                               </telerik:RadListBox>
                           </ItemTemplate>
                       </telerik:RadMenuItem>
                   </Items>
               </telerik:RadMenuItem>
               <telerik:RadMenuItem Text="Text">
                   <Items>
                       <telerik:RadMenuItem Text="Sub Menu">
                           <ItemTemplate>
                               <asp:RadioButtonList ID="rbText" runat="server" RepeatDirection="Vertical">
                                   <asp:ListItem Text="Case as input" Value="1"></asp:ListItem>
                                   <asp:ListItem Text="All Caps" Value="2"></asp:ListItem>
                               </asp:RadioButtonList>
                           </ItemTemplate>
                       </telerik:RadMenuItem>
                   </Items>
               </telerik:RadMenuItem>
           </Items>          
       </telerik:RadContextMenu>
   </div>
   <telerik:RadAjaxManager ID="RadAjaxManager" runat="server" OnAjaxRequest="RadAjaxManager_AjaxRequest">
       <AjaxSettings>
           <telerik:AjaxSetting AjaxControlID="RadAjaxManager">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="RadMenu1" LoadingPanelID="RadAjaxLoadingPanel" />
               </UpdatedControls>
           </telerik:AjaxSetting>
       </AjaxSettings>
   </telerik:RadAjaxManager>
   <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel" runat="server" Skin="Vista">      
   </telerik:RadAjaxLoadingPanel>

As you can see I have composite contextmenu which contains various server controls inside it (i.e Textbox, Listbox, Radiobutton).

Now I want to populate these contextmenu control with the dynamic values based on right clicked listview item. So for that I am performing an OnAjaxRequest="RadAjaxManager_AjaxRequest" request on OnClientShowing="LoadContextMenu" client event of Contextmenu.

Now the issue is that OnClientShowing event it is going to RadAjaxManager_AjaxRequest server request & performing all the server side update on context menu.
But the contextmenu is not repainted at clientside. i.e After server side processing, it is not showing on browser.
function LoadContextMenu(menu, args) {
                if (listItemIndex) {
                    InitiateAsyncRequest(listItemIndex);
                }
            }
 
function InitiateAsyncRequest(argument) {
                var ajaxManager = $find("<%= RadAjaxManager.ClientID %>");
                ajaxManager.ajaxRequest(argument);
                return false;
            }

Can you please help me how to reshow / repaint the contextmenu after AjaxRequest is performed.

1 Answer, 1 is accepted

Sort by
0
Navnit
Top achievements
Rank 1
answered on 06 Dec 2012, 05:26 AM
Hi,

I am able to find the solution for the above. Thanks.
Tags
Menu
Asked by
Navnit
Top achievements
Rank 1
Answers by
Navnit
Top achievements
Rank 1
Share this question
or