datagrid parentrow or childrow

  • Thread starter Thread starter Marjolein Hubrecht
  • Start date Start date
M

Marjolein Hubrecht

Hi

How do I determine on the currentcellchanged event of my datagrid if the
currentcell is in a parent row or in a child row?

Thanks

Marjolein
 
You need to use the currency manager. This will let you get at the actual
row that's current and from that row you will be able to determine which
table you are in, whether there are child or parent rows etc etc.
CurrencyManager cm = (CurrencyManager) dataGrid1.BindingContext[myDataSet];

DataRowView row = (DataRowView) cm.Current;

Hope that helps,

--
 
The cm.current stays the same if I click a parent or a child row in my
datagrid.
My datasource is a custom collection that implements IBindingList.
So my cm.current contains a parent object with a collection of child
objects.

My grid contains two tablestyles, should I maybe look in that direction?

Thanks

marjolein


Pete Wright said:
You need to use the currency manager. This will let you get at the actual
row that's current and from that row you will be able to determine which
table you are in, whether there are child or parent rows etc etc.
CurrencyManager cm = (CurrencyManager) dataGrid1.BindingContext[myDataSet];

DataRowView row = (DataRowView) cm.Current;

Hope that helps,

--
--------------------------------------------------------
Peter Wright (www.petewright.org)
Author of ADO.NET Novice To Pro
From Apress. www.apress.com (and 10
other doorstops from Wrox)


Marjolein Hubrecht said:
Hi

How do I determine on the currentcellchanged event of my datagrid if the
currentcell is in a parent row or in a child row?

Thanks

Marjolein
 
Back
Top