I am using WebMenu as a contextmenu for ultrawebgrid cells. The contextmenu works fine if I place the webgrid and webmenu directly in the page. The problem starts when I am trying to create a usercontrol using webgrid and webmenu, contextmenuclick(right click on grid cell) gives me an error saying "Popup name not valid".
igmenu_showMenu("<%=this.MROContextMenu.ClientID %>",null,0,0);
Thanks
Thanks for the information. Finally the webmenu works in the user control fine without changing any code.
The reason this does not work for our WebMenu and also our WebTree controls is that the id registered on the client will have all underscores removed. This is a known issue and cannot be fixed due to the possibility of breaking too many legacy applications.
You can do as micvoiss suggested and handle the client side initialize events and store the generated ids in global javascript variables. You can also write a server side method that will remove all underscores from a string and use that method in your code rendering block. For example, my method on the server side would look something like this:
{
}
Then on the client side, I can get the correct ids by doing somethign like this (in reference to the script in the original post):
igmenu_showMenu("<%=getNavClientId(this.MROContextMenu.ClientID) %>",null,0,0);
Thanks a lot for helping.
The strange thing is, that once it worked, without a changing anything. I really have no clue why, but anyway.
Thanks, Martin.
What I ended up doing was to declare variables for the grid and menu, and then assign the values to them on their load events, like this. I pieced this together from a few different examples I had seen for different issues. Hope it helps.
Mike
var MyMenuId; var MyGridId; function uwgListsEntered_InitializeLayoutHandler(gridName){ // because we have the grid within a masterpage and within the content placeholder we have to capture the // name of the grid when it is initialized, otherwise the name has the contentplaceholder as it's prefix. MyGridId = gridName;} function InitializeLayout(menuId) { MyMenuId = menuId; }
May be some code on how u r calling the menu would help.