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
Hello,
You can use the client-side InitializeMenu event of UltraWebMenu to find out the ID of the menu, and later use it to show the context menu. I did a quick search in our forum archives and found out that a customer has reported a problem very similar to yours (same error message while trying to show context menu for grid or treeview) and as the discussion goes on, it appears that the InitializeMenu approach resolved the problem.
Link (I am using tinyurl since the link is very long and gets corrupted in the HTML editor Community Server is using):
http://tinyurl.com/yu2qjd
I hope this helps. Please, let me know if this is not working / not applicable in your setup.
Thank you very much for that pointer. I have tried using the InitializeMenu event and got the menu id. Now that error has gone but I am not able to see the menu. No error and no context menu. Strange thing!!! any ideas??
The code now is :
<MenuClientSideEvents ItemClick="ContextMenuItemClick" InitializeMenu="InitializeLayout" />
In BLOCKED SCRIPT
{
MyMenuId = menuId;
alert(MyMenuId);
}
igmenu_showMenu(MyMenuId,null,0,0);
Thanks.
Thanks for the follow-up. Is the alert showing the correct client-side ID?
In any case, I believe the key here could be the parameters to the igmenu_showMenu method. I've found out several test project demonstrating this live in action, and they always required a valid "event" (the second parameter), plus some coordinates - x,y (third and fourth parameters).
You can find the following KB article useful:
HOWTO:How to show and hide the UltraWebMenu when used as a context menu
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.Aspx?ArticleID=10083
It demonstrates sample code/approach, plus there a couple of projects attached to it where you can see this live in action.
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.
Hello!
I have the same problem. When i put the webmenu in the aspx-page it works fine. Now i wanted to move them in a user control. First it ran fine at my computer, as well as at one hosting system. At the other hosting system the webmenu doesn't work anymore. I get the menu, but i can't click on the items to get the submenus and i get the error that the igMenu_ // _events is not defined. Any ideas what i can do to run the webmenu in a user control?
If you are already using ASP.NET 3.5, you can try using the not very popular, but very helpful client-side method getLocation to get the coordinates of the element clicked and place the menu there. Some information can be found here:
http://weblogs.asp.net/bleroy/archive/2008/01/29/getting-absolute-coordinates-from-a-dom-element.aspx
If you are still using ASP.NET 1.x / 2.x, you can try using the FindPos function proposed by the QuirksMode website (a very useful site on all things Javascript/DOM)
http://www.quirksmode.org/js/findpos.html
Hope this helps / provides additional clues.