Textbox inside ContextMenu

5 posts, 0 answers
  1. Brian
    Brian avatar
    3 posts
    Member since:
    May 2013

    Posted 09 May 2013 Link to this post

    Hi,

    I need to get a Textbox to show inside a ContextMenu control. If this is possible, can you provide some directions to get this done. If it's not possible, can you provide suggestions on how I can accomplish this.

    Thanks. 
  2. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 10 May 2013 Link to this post

    Hello Brian,

    You can easily achieve the desired scenario by using templates in the Items of the RadContextMenu. Here you can see an example with the RadMenu that would work identically with the RadContextMenu.

    Kind regards,
    Kate
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Brian
    Brian avatar
    3 posts
    Member since:
    May 2013

    Posted 10 May 2013 Link to this post

    That helps a bit, but I'm running into a new problem. I've placed a button inside a context menu which is within an AjaxPanel, but the button click is causing a full postback. Do you see any reason why the click isn't ajaxified?


    <telerik:RadAjaxPanel runat="server" ID="AjaxPanel" LoadingPanelID="RadAjaxLoadingPanel1"  OnAjaxRequest="RadAjaxRequest" Height="100%">
            <telerik:RadContextMenu Id="RadMenuUnprioritized" Runat="server" onitemclick="RadMenuUnprioritized_ItemClick">     
                 
                <Items>                           
                    <telerik:RadMenuItem PostBack="false" runat="server">   
                        <ItemTemplate>
                            <telerik:RadButton ID="btnStandard" runat="server" Text="Submit" AutoPostBack="true" onclick="btnStandard_Click">
                            </telerik:RadButton>
                        </ItemTemplate>        
                    </telerik:RadMenuItem>                                   
                </Items>
                <Targets>
                   <telerik:ContextMenuControlTarget ControlID="Grid_Unprioritized" />
                </Targets>
            </telerik:RadContextMenu>
    </telerik:RadAjaxPanel>
  5. Brian
    Brian avatar
    3 posts
    Member since:
    May 2013

    Posted 10 May 2013 Link to this post

    I sorta solved the problem by calling the click method on the MenuItem via javascript. The only problem left is that an ajax call is also made when clicking the background of the MenuItem..



    function setPriority() {
                    var menu = $find("<%=RadMenuUnprioritized.ClientID %>");
                    var templateButton = menu.findItemByText("RadMenuItem1");
                    templateButton.click();
     
                    return false;
    }



    <telerik:RadAjaxPanel runat="server" ID="AjaxPanel" LoadingPanelID="RadAjaxLoadingPanel1"  OnAjaxRequest="RadAjaxRequest" Height="100%">
            <telerik:RadContextMenu Id="RadMenuUnprioritized" Runat="server" onitemclick="RadMenuUnprioritized_ItemClick">                 
                <Items>                           
                    <telerik:RadMenuItem Text="RadMenuItem1" PostBack="true" runat="server">   
                        <ItemTemplate>
                        <telerik:RadTextBox ID="RadTextBox4" runat="server" AutoPostBack="True" Width="50px"></telerik:RadTextBox>
                        <telerik:RadButton ID="btnStandard" runat="server" Text="Submit" AutoPostBack="false" OnClientClicked="setPriority">
                        </telerik:RadButton>
                        </ItemTemplate>        
                    </telerik:RadMenuItem>                                   
                </Items>
                <Targets>
                   <telerik:ContextMenuControlTarget ControlID="Grid_Unprioritized" />
                </Targets>
            </telerik:RadContextMenu>
    </telerik:RadAjaxPanel>


  6. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 15 May 2013 Link to this post

    Hi Brian,

    Please take a look at the following demo where you can find a very good example how to use contextmenu with a RadGrid control - Ajax Enabled Context Menu

    All the best,
    Kate
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017