// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Get the active worksheet
Worksheet sheet = grdDataEntry.GetActiveWorksheet();

// Set the total columns diaplyed in the grid
sheet.ColumnsCount = 15;

// Set the total rows displayed in the grid
sheet.RowsCount = 15;

// Define a new menu item and specify its event handler
MenuItem mi = new MenuItem("newMenuItem", new System.EventHandler(miClicked));

// Set the label
mi.Text = "New Item";

// Add the menu item to the GridDesktop's context menu
grdDataEntry.ContextMenu.MenuItems.Add(mi);