Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to disable right click menu/ context menu of datagrid

How to disable right click menu/ context menu of datagrid

Scheduled Pinned Locked Moved C#
tutorial
4 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Software_Guy_123
    wrote on last edited by
    #1

    Hello, In windows application we are using datagrid in readonly mode. If user right clicks on particular cell then copy/ paste menu is displaying. User is copying content and trying to paste in other cell, as datagrid is in readonly mode so user can't paste, but in first cell it is showing edit icon. We don't want that edit icon if datagrid is readonly, so I thought we can disable right click menu only. If any other solution is available for hiding edit icon, please let me know. Anybody if knows, solution for this, please give URL or sample code.

    Thanks & Regards, Kumar

    M S 2 Replies Last reply
    0
    • S Software_Guy_123

      Hello, In windows application we are using datagrid in readonly mode. If user right clicks on particular cell then copy/ paste menu is displaying. User is copying content and trying to paste in other cell, as datagrid is in readonly mode so user can't paste, but in first cell it is showing edit icon. We don't want that edit icon if datagrid is readonly, so I thought we can disable right click menu only. If any other solution is available for hiding edit icon, please let me know. Anybody if knows, solution for this, please give URL or sample code.

      Thanks & Regards, Kumar

      M Offline
      M Offline
      Martin 0
      wrote on last edited by
      #2

      Hello You can disable the contextmenu if you path an empty menu to the property of the control:

      ContextMenu cm = new ContextMenu();
      yourControl.ContextMenu = cm;

      Or you modify the existing menu liek you want.

      All the best, Martin

      S 1 Reply Last reply
      0
      • M Martin 0

        Hello You can disable the contextmenu if you path an empty menu to the property of the control:

        ContextMenu cm = new ContextMenu();
        yourControl.ContextMenu = cm;

        Or you modify the existing menu liek you want.

        All the best, Martin

        S Offline
        S Offline
        Software_Guy_123
        wrote on last edited by
        #3

        Hello Martin, Thank you for your reply, but it is working for datagrid like column header. My problem is datagrid populated with few rows and columns, If I select from columns new menu is not displaying, it is displaying default windows right click menu i.e. Undo, Cut, Copy, Paste,Delete and Select All. I want to disable or hide this menu. once again thank you for your help.

        Thanks & Regards, Kumar

        1 Reply Last reply
        0
        • S Software_Guy_123

          Hello, In windows application we are using datagrid in readonly mode. If user right clicks on particular cell then copy/ paste menu is displaying. User is copying content and trying to paste in other cell, as datagrid is in readonly mode so user can't paste, but in first cell it is showing edit icon. We don't want that edit icon if datagrid is readonly, so I thought we can disable right click menu only. If any other solution is available for hiding edit icon, please let me know. Anybody if knows, solution for this, please give URL or sample code.

          Thanks & Regards, Kumar

          S Offline
          S Offline
          Software_Guy_123
          wrote on last edited by
          #4

          Hello, In .Net 2.0 version, windows form, we are using readonly datagrid. for this grid if user selects any cell and right click then windows context menu i.e. cut, copy, paste... is displaying. Now user is selecting some other cells and try to paste then in rowheader it is dispalying edit icon. We don't want this edit icon should be display at rowheader but context menu should be display. Your help is greatly appreciated.

          Thanks & Regards, Kumar

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups