This is a migrated thread and some comments may be shown as answers.

ContextMenu __doPostBack not working.

1 Answer 110 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Dan Miller
Top achievements
Rank 1
Dan Miller asked on 12 Nov 2010, 08:38 PM
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();
  if(arg)
  {
    __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?

Thanks,
Dan Miller

1 Answer, 1 is accepted

Sort by
0
Cori
Top achievements
Rank 2
answered on 16 Nov 2010, 07:39 PM
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.
Tags
Menu
Asked by
Dan Miller
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
Share this question
or