DataGrid question

  • Thread starter Thread starter rob willaar
  • Start date Start date
R

rob willaar

I use the datagrid to display the results after a db search.
But i like only entire rows (not cells) to be selected, and when somebody
doubleclicks somewere on a row to have a doubleclick event for that row.
 
rob willaar said:
I use the datagrid to display the results after a db search.
But i like only entire rows (not cells) to be selected, and when somebody
doubleclicks somewere on a row to have a doubleclick event for that row.

I used the CurrentCellChanged event, but you can apply it to any event you like:

private void dataGrid1_CurrentCellChanged(object sender, System.EventArgs e)
{
dataGrid1.Select(dataGrid1.CurrentCell.RowNumber);
}

I hope that helps.

- carl
 
Am Tue, 31 Aug 2004 19:38:36 +0200 schrieb rob willaar:
I use the datagrid to display the results after a db search.
But i like only entire rows (not cells) to be selected, and when somebody
doubleclicks somewere on a row to have a doubleclick event for that row.

Hi Rob,

I guess you'll have to override DataGrids functionality by youreself.
To mark the entire row you'll have to inherit from DataGridColumnStyle and
override the Paint method. There you can paint the background of the
selected row.
For the doubleclick- event you can override the DataGrid's OnMouseUp/ Down,
Click or DoubleClick and raise that event youreself.

Depending on how much money you can spend I'd suggest to buy a third- party
Grid. We use Janus' GridEx and I surly can recommend that.


Munir Husseini
 
Back
Top