ContextMenu __doPostBack not working.

2 posts, 0 answers
  1. Dan Miller
    Dan Miller avatar
    23 posts
    Member since:
    Jul 2010

    Posted 12 Nov 2010 Link to this post

    I have a page with a ContextMenu on it. The ContextMenu has an option where it opens up a RadWindow. Inside the window there are different buttons that close the RadWindow then send back an argument to the page indicating which button was clicked. I then take this argument and using the OnClientClose event on the RadWindow run a javascript function that is supposed to "click" the ContextMenu on the page using the __doPostBack function.

    function OnClientclose(sender, eventArgs){
      var arg = eventArgs.get_argument();
        __doPostBack("'" + RadContextMenu.ClientID.Replace("_", "$") + "'", arg);

    The ContextMenuItem that is clicked is determined by the argument passed, the argument is either a 0,1, or 3 which is the location of the item in the ContextMenu (see contextmenu.gif). I have checked that the argument being passed back is correct. I have used the __doPostBack function in the past to click on a ContextMenu in exactly the same fashion. I have checked the page source and the ID in the __doPostBack matches the ID of the ContextMenu exactly except all the _ have been replaced by $ which was needed before to have it work. Any ideas why I cannot get it to trigger a "click" this time?

    Dan Miller
  2. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 16 Nov 2010 Link to this post

    Hello Dan,

    I don't know what the problem is, but instead of replacing the underscores with $ using Replace, you can use UniqueID, since it does that for you.

    Also, when you return the value back from the RadWIndow, are you returning it as an int or as a string? Possibly the reason it doesn't work. If so, call the toString() method on arg.
Back to Top