Context Menu Client Side Code

I'm trying to get the following javascript code to work:

var menu = $get( "m_menuVersionsContext" );
if( menu != null )
{
menu.ShowContextMenu(null,null,event,sData );
}

At runtime the actual name of the menu control is ct100_ContentPlaceHolder1_ct102_ct105_m_menuVersionsContext. How am I supposed to get hold of the context menu control when its name is so dynamic?

Thanks
Steve



1 Reply

RP Rekha P Syncfusion Team January 20, 2009 12:13 PM UTC

Hi Steve,

Thank you for your interest in Syncfusion Products.

In order to show the context menu, Menu control's ClientObjectId is used to access the ShowContextMenu method.
Please refer the code snippet below to achieve this.

[javascript]


function showcontextmenu(odata)
{
var bShowMenu = false; var oEvent = odata.Event;

MenuClientObjectId.ShowContextMenu( null, null, oEvent, odata ); //MenuClientObjectId is the ClientObjectId of Menu control

return bShowMenu;
}


Also please refer the sample below which illustrates the above.

http://websamples.sy ncfusion.com/samples/Tools.Web/6.3.0.6/52846_ContextMenu/main.htm

Please let me know if you have any concerns.

Thanks,
Rekha


Loader.
Up arrow icon