Context Menu in ASP.NET MVC Spreadsheet

23 Jun 20202 minutes to read

Context Menu is used to improve user interaction with Spreadsheet using popup menu. This will open when right clicking on Cell/Column Header/Row Header/Pager in Spreadsheet. You can use EnableContextMenu property to enable/disable context menu.

Default Context Menu items

Please find the below table for default context menu items and its actions.

Section
Context Menu items
Action
Row Cell
Cut
Cut the selected cells content to the clipboard, so that you can paste it somewhere else.
Copy
Copy the selected cells content to the clipboard, so that you can paste it to somewhere else.
Paste
Paste the content from clipboard to spreadsheet.
Insert
Insert new cells or rows or columns to worksheet.
Delete
Delete existing cells or rows or columns from worksheet.
Sort
Perform sorting to the selected range of cells by ascending or descending.
Filter
Perform filtering to the selected cells based an active cell's value or active cell's color.
Hyperlink
Create a link in the spreadsheet for quick access to webpages or worksheet reference.
Comment
Add a note or extra information about the active cell.
Format Cells
Apply number format to the selected cells.
Clear Contents
Delete the contents in the selected cells.
Row Header / Column Header
Cut
Cut the selected cells content to the clipboard, so that you can paste it to somewhere else.
Copy
Copy the selected cells content to the clipboard, so that you can paste it to somewhere else.
Paste
Paste the content from clipboard to spreadsheet.
Clear Contents
Delete the contents in the selected cells.
Insert
Insert new cells or rows or columns to worksheet.
Delete
Delete existing cells or rows or columns from worksheet.
Hide
Hide the selected columns/rows.
Unhide
Unhide the selected columns/rows.
Pager
Insert
Insert new worksheet to spreadsheet.
Delete
Delete the selected worksheet from spreadsheet.
Move or copy
Opens move or copy dialog to move worksheet or to create duplicate worksheet.
Rename
Rename the selected worksheet.
Protect Sheet
Prevent unwanted changes from others by limiting their ability to edit.
Hide
Hide the selected worksheet.
Unhide
Opens unhide dialog to unhide worksheet.

The following code example describes the above behavior.

  • CSHTML
  • @(Html.EJ().Spreadsheet<object>("Spreadsheet")
        .EnableContextMenu(true)
    )

    Context menu at cell

    Context menu at Cell

    Context menu at column header

    Context menu at Column Header

    Context menu at row header

    Context menu at Row Header

    Context menu at pager

    Context menu at Pager