"Cor Ligthert" <(E-Mail Removed)> wrote in
news:(E-Mail Removed):
> How are you, we did a long time not see you here, (two days ago I saw
> you again). For this you need the and the bindingmanager position.
Thanks. Just been busy.
> http://msdn.microsoft.com/library/de...en-us/cpref/ht
> ml/frlrfsystemwindowsformsbindingmanagerbaseclasspositiontopic.asp
>
> or currencymanager position
> http://msdn.microsoft.com/library/de...en-us/cpref/ht
> ml/frlrfsystemwindowsformscurrencymanagerclasspositiontopic.asp
Not quiet.. The second one is a descendant of the first class, and merely
is an override.
Here is what we are using now - it does work even if the user resorts the
grid:
CurrencyManager xCM = (CurrencyManager)BindingContext[dataGrid1.DataSource,
dataGrid1.DataMember];
DataRowView xDRV = (DataRowView)xCM.Current;
AdminWS.AdminCartReadDS.CartRow xCart
= (AdminWS.AdminCartReadDS.CartRow)xDRV.Row;
However this is a lot of work just to get the current row. Im hoping there
is a shorter way - and that its not just another example of .NET being
overengineered without the appropriate "practical" short cut being added.
According to your post, this should work:
CurrencyManager xCM = (CurrencyManager)BindingContext[dataGrid1.DataSource,
dataGrid1.DataMember];
AdminWS.AdminCartReadDS.CartRow xCart
= ((AdminWS.AdminCartReadDS.CartDataTable)dataGrid1.DataSource)
[xCM.Position];
But:
1) Thats still way to much to get the current row.
2) It works - only until the user sorts the grid, which is the same result
as using the position from the grid directly. Unsorted it works -but not
sorted. Sorted rearranges the grid - but not the datatable of course.
CurrencyManager.Position seems to refer to the same as the grid row index.
There SHOULD be something like
RowType xRow = (RowType)grid.something.currentrow
There probably isnt - although there should be. But even in .NET there
should be SOMETHING shorter than what we are currently doing.
> By the way the clicked sorted column is reflected in the
> defaultview.sort property
Yes, but unless I resort the underlying datatable.. which is not only hack,
but has bad side effects.
> Quiet easy to use.
Is it? What am I missing?
--
Chad Z. Hower (a.k.a. Kudzu) -
http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
Empower ASP.NET with IntraWeb
http://www.atozed.com/IntraWeb/