DataGrid Hierachy Objects

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I've been working with the Windows Forms datagrid, and can't seem to figure
out how to get the currently selected row when dealing with objects that have
a Hierachy.

For example we have a recursive tree like structure that consists of
DecisionMakers. The objects we are dealing with in this case are the
following
a.) DecisionMakerCollection Class
b.) DecisionMaker class.

The DecisionMaker class conains the following Information.
1.) string - ContactName
2.) DecisionMakerCollection - Children

How can I get the current selected row, if I've used the navigation links on
the datagrid to go down x levels?

I have seen code similar to this, but it only seems to return the last row
you were working with at the Top level of the hierachy.

CurrencyManager currencyManager
=(CurrencyManager)this.dataGridDecisionMakers.BindingContext[_decisionMakers];

OpportunityDecisionMaker decisionMaker =
(DecisionMaker)CurrencyManager.Current;

Can someone point me in the right direction?
Thanks,
Charlie
 
Hi,

"(e-mail address removed)"
Hello,
I've been working with the Windows Forms datagrid, and can't seem to
figure
out how to get the currently selected row when dealing with objects that
have
a Hierachy.

For example we have a recursive tree like structure that consists of
DecisionMakers. The objects we are dealing with in this case are the
following
a.) DecisionMakerCollection Class
b.) DecisionMaker class.

The DecisionMaker class conains the following Information.
1.) string - ContactName
2.) DecisionMakerCollection - Children

How can I get the current selected row, if I've used the navigation links
on
the datagrid to go down x levels?

I have seen code similar to this, but it only seems to return the last row
you were working with at the Top level of the hierachy.

CurrencyManager currencyManager
=(CurrencyManager)this.dataGridDecisionMakers.BindingContext[_decisionMakers];

When you navigate down or up a level the DataMember of the DataGrid will
change and when asking for the CurrencyManager you need to use the right
DataMember.

Try:
CurrencyManager currencyManager = (CurrencyManager)
dataGridDecisionMakers.BindingContext[
dataGridDecisionMakers.DataSource,
dataGridDecisionMakers.DataMember ] );


HTH,
greetings
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top