Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > Menu > Open RadContextMenu through Code

Answered Open RadContextMenu through Code

Feed from this thread
  • Posted on Dec 16, 2011 (permalink)

    Hello,

    I have a question about the RadContextMenu. My problem is I am not able to open a RadContextMenu manually through the code.

    * I created a ContextMenu + MenuItems in code behind
    * I NOT called the function RadContextMenu.SetContextMenu
    * I set IsOpen = true for opening the menu => Error:  Unhandled Error (Application_UnhadledException) Object reference not set to an instance of an object

    What do I wrong, how can I open a ContextMenu through code behind????

    regards Richard Koslik

    Reply

  • Answer Yana Yana admin's avatar

    Posted on Dec 16, 2011 (permalink)

    Hi Richard,

    You should set a target to the context menu in order to open it properly. This can be done by other using SetContextMenu method as explained here or setting its PlacementTarget property:

    RadContextMenu contextMenu = new RadContextMenu();
    contextMenu.Items.Add(new RadMenuItem() { Header = "test item" });
    contextMenu.PlacementTarget = targetTextbox;
    contextMenu.IsOpen = true;

    Kind regards,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

  • Posted on Dec 19, 2011 (permalink)

    Thanks, it works now!

    regards Richard Koslik

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > Menu > Open RadContextMenu through Code
Related resources for "Open RadContextMenu through Code"

Silverlight Menu Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]