CurrencyManager Position issue

P

Pete Davis

I'm asking to see if anyone has found a way to deal with the issue of
"non-selection" with the CurrencyManager. In particular, we have a grid
control that we've created. When you have a parent and child grid, the
CurrencyManager for each is set to the first row, so if the first row of the
parent data has child rows, the child rows are displayed by default in the
child grid.

The problem is, we want the grid to come up with no rows selected. If there
is data in the CurrencyManager, then you can't set the position to -1. Doing
so simply sets it to 0, and thus any related CurrencyManagers will have
child data.

How have others dealt with this problem? Has anyone dealt with it?

If we don't actually show the row as selected, then it's confusing to the
user where the data in the child table comes from, so if the child table is
showing data, then you want to be showing a selection in the parent table so
that the source of the child data is obvious.

I tried using reflection to set the internal "listposition" of the
CurrencyManager to -1, but it didn't like that. It crapped out later on in
the child CurrencyManager with an invalid index exception.

Thanks for any ideas anyone can offer.

Pete
 
D

David Lei

You can by default highlight the first row as selected,
using DataGrid.Select(rowIndex) method.

David
 
P

Pete Davis

Sorry, maybe I wasn't entirely clear. Our grid is a custom grid, not the MS
DataGrid.

Our grid has a requirement that the current row also be selected. However,
we also have a requirement that non-selection be possible (in our case,
current row = -1)

But, if we tie the current row to the CurrencyManager, a current row of -1
is impossible. Furthermore, there's no way for us to prevent data from being
displayed in the child table if the first parent row has child records.

So my question is, has anyone found a way around this? Some way to represent
non-selection in the CurrencyManager?

Pete
 

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

Top