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
155
How to get Grid reference in Context menu of Ultragrid ?
posted

I have added dynamically a context menu and added a menu item to it to export grid. 

grid.ContextMenu.MenuItems.Add("Export Grid", new EventHandler(gridExporter));

private void gridExporter(object sender, EventArgs e){

...

..

this.ugExcelExporter.Export(grid, fileName);

}

How do I get the grid reference in the event handler. The sender in this case is the MenuItem. I can hardcode the grid but I want a generic function that I can use it for multiple grids.

Thanks,Praveen