-1

Does anyone know how to handle the right-click event on Datagrid? I look in the document but found nothing.

jimbo R
  • 253
  • 2
  • 3
  • 14

1 Answers1

0

You need to add a ContextMenuStrip componen.

Once added the ContextMenuStrip componen in the gridview you look for the ContextMenuStrip property and specify the one you added.

To the ContextMenuStrip you add the options you need for example edit or delete.

To each button you add a click event and use the following code:

private void EditToolStripMenuItem_Click(object sender, EventArgs e)
{
   //With this code we retrieve the information from the table where the right click was executed
   var info = gridview1.GetFocusedRow();

   code....
}

PS: C# code.

Please specify what language you work in when you ask a question

Sorry for my English, but my native language is Spanish.