God Damn DataGrids
Posted on 2004-08-19
I'm displaying some records from a database in a DataGrid right? I don't want the data to be editable, so I've set the ReadOnly field of the DataGrid to true, but the user can still select a cell. I want the DataGrid to work more like your inbox in Outlook Express, where when you click on a row, the whole row is highlighted, not just a cell. So I tried this:
private void objTreeGrid_CurrentCellChanged(object sender, System.EventArgs e)
int intRow = objTreeGrid.CurrentRowIndex;
Which kinda works, the whole row becomes selected, but the cell that was clicked also changes into its selected state. I've tried:
objTreeGrid.CurrentCell = new DataGridCell(-1, -1);
But that just selects the first cell in the first row. There must be a way to unselect a cell?
Help me, I'm loosing my mind.