0

I am using Data Grid View control in my project and the requirement is below. Row Headers Visible = true, Column Headers Visible = true, Multiple Select = true, Selection Mode = Full Row Select. Allow multiple rows selection true but do not allow to select all rows when user clicks on top left cell.

Please help me!!!!!!!

3 Answers3

0

The top left cell's only purpose is to select all the cells, I don't think that could be disabled.

In any case you can use a if condition to check whether all the rows are selected and proceed accordingly.

ps: I am new to C# and dont know much

  • I am able to deselect all rows using if condition, but it's looks like a flash. When i click top left cell, in the Cell_Click() event first it selects all rows then it executes my code. It's looks like a blink. Do you have any idea to remove blink? – Marulasiddesha Aug 07 '12 at 06:18
0

Thanks to @anchandra response from this other SO thread you may accomplish that behavior by overriding the OnCellMouseDown behaviour:

protected override void OnCellMouseDown(DataGridViewCellMouseEventArgs e)
{
    if (e.RowIndex == -1 && e.ColumnIndex == -1) return;
    base.OnCellMouseDown(e);
}
Community
  • 1
  • 1
Luis Quijada
  • 2,345
  • 1
  • 26
  • 31
-1

Set the RowHeadersVisible to false.