ContextMenu not visible after OnAjaxRequest

2 posts, 0 answers
  1. Navnit
    Navnit avatar
    8 posts
    Member since:
    Oct 2012

    Posted 04 Dec 2012 Link to this post

    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.
  2. Navnit
    Navnit avatar
    8 posts
    Member since:
    Oct 2012

    Posted 05 Dec 2012 Link to this post

    Hi,

    I am able to find the solution for the above. Thanks.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top