Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
508
WebMenu giving problem when used in UserControl
posted

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".

The code for showing the contextmenu is

igmenu_showMenu("<%=this.MROContextMenu.ClientID %>",null,0,0);

Can somebody point what I am missing!!

Thanks

Parents
No Data
Reply
  • 10880
    posted

    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:

    protected string getNavClientId(string s)

    {

    return s.Replace("_", string.Empty);

     

    }

    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);

Children