Home > DeveloperSection > Forums > Datagridview cellcontent click event not working properly
john rob

Total Post:108

Posted on    December-12-2013 1:55 AM

 C# C# 

 1 Reply(s)
 1223  View(s)
Rate this:

I wrote an event to retrieve the first cell value of the clicked cell's row on CellContentClick event in datagridview. but the event is getting raised only when i click the third cell and not getting raised when i click the first or second cell of datagridview.

Please help me.

Pravesh Singh

Total Post:412

Posted on    December-12-2013 2:26 AM

Hi John,

Try to implement the CellClick event instead of CellContentClick event

private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)


   DataGridView theGrid = sender as DataGridView;

   if(theGrid != null)


      DataGridViewCell selectedCell = theGrid.SelectedCells[0];

      //Do your logic here



Don't want to miss updates? Please click the below button!

Follow MindStick