Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Menu > Context menu on asp:TextBox
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Context menu on asp:TextBox

Feed from this thread
  • sjurmr avatar

    Posted on Jan 11, 2007 (permalink)

    Hi,

    I'm trying to get the RadMenu context-menu to work with right-clicks on an asp:TextBox. The problem is the context-menu of the browser goes on top (for copy/paste and so on) and hides the RadMenu context menu.

    Edit: Note, I'm using the Q3 version.

    Please advice on how to resolve this.

    Regards,
    Sjur Rondestveit

  • Peter Peter admin's avatar

    Posted on Jan 11, 2007 (permalink)

    Hi Sjur,

    I did a small test project based on your description but I didn't observe any problems with the menu. Could you please view the attached project and let us know what is different in your case.



    Regards,
    Peter
    the telerik team
    Attached files

  • sjurmr avatar

    Posted on Jan 11, 2007 (permalink)

    Thank you for your quick response.
    The main difference is 1.1 framework. Also, my page has the old ASP.NET menu-control on top, I don't know if this is messing things up.

    If the context menu is not attached to a control I can rightclick over a textbox and it works as expected, but attaching it brings up the problem.

    Regards,
    Sjur

  • Peter Peter admin's avatar

    Posted on Jan 11, 2007 (permalink)

    Hi Sjur,

    I tested the case under .NET 1.1 and found out that the menu goes under the asp textbox control. However, the browser context menu didn't show (on right click of the textbox). To make the menu display over the context menu element, you need to set the z-index of the menu to large enough value. For example, try:

    <radM:RadMenu id="RadMenu1" IsContext="True" style="Z-INDEX: 10000"/> 

    Don't hesitate to correct me if I am missing something here.


    Greetings,
    Peter
    the telerik team

  • Brinda avatar

    Posted on May 11, 2011 (permalink)

    Hi,

    I'm trying to get Intellisense functionality for my textbox.so i used the RadMenu context-menu on an asp:TextBox . That is when i press dot char the context menu should be displayed with the correct positioning.

    Can anyone say me how to proceed

  • Posted on May 11, 2011 (permalink)

    Hello Bindra,

    You can show the RadContextMenu explicitly using the following methods.
    • show(event):Displays the menu as a pop-up, using the position in the DOM event that is passed as a parameter.
    • showAt(int X, int Y):Displays the menu as a pop-up at the coordinates specified by the parameters.
    Here is a sample code to achieve the same.

    aspx:
    <asp:TextBox ID="TxtBox3" runat="server"></asp:TextBox>
    <telerik:RadContextMenu ID="RadContextMenu1" runat="server" ClickToOpen="false">
                <Items>
                    <telerik:RadMenuItem Text="Hai">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem Text="Item2">
                    </telerik:RadMenuItem>
                </Items>
    </telerik:RadContextMenu>

    Javascript:
    function KeyEvent(e)
      {
        var txt = document.getElementById("TxtBox3");
        var menu = $find("<%=RadContextMenu1.ClientID %>");
        if ((!e.relatedTarget) || (!$telerik.isDescendantOrSelf(contextMenu.get_element(), e.relatedTarget)))
        {
            menu.show(e);
        }
        $telerik.cancelRawEvent(e);
    }

    And attaching the keypress event from pageload.
    C#:
    protected void Page_Load(object sender, EventArgs e)
       {
           TxtBox3.Attributes.Add("onkeypress", "KeyEvent(event)");
       }
    Thanks,
    Princy.

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Menu > Context menu on asp:TextBox