SortedBindingList ErrorProvider

SortedBindingList ErrorProvider

Old forum URL: forums.lhotka.net/forums/t/730.aspx


vitorsilva posted on Wednesday, July 26, 2006

hi
i have a datagrid that is binded to a SortedBindingList, using something like this:

_originalList = Customers.GetCustomers()
_sortedList = New Csla.SortedBindingList(Of AnoLectivo)(_originalList)
_sortedList.ApplySort("Name", System.ComponentModel.ListSortDirection.Ascending)
bindingSourceCustomers.DataSource = _originalList '_sortedList

everything works fine except that the Validation Rules that i've added to the underlying business object are not validated... or so i think because if i insert some invalid data i don't get the error provider message...

i've tried binding directly to the underlying business object, and that way everything works fine.

any suggestion?

ajj3085 replied on Wednesday, July 26, 2006

One error is that you're binding the datasource to the orginal list, when you should be bindnig to the sorted list.  If you fix that, does it solve your problem?  Also, make sure the controls are bound to the binding source, and not directly to the object.  It may be picky in that regard.

Andy

vitorsilva replied on Wednesday, July 26, 2006

"One error is that you're binding the datasource to the orginal list, when you should be bindnig to the sorted list. "
that was a copy/past error :)

_originalList = Customers.GetCustomers()
_sortedList = New Csla.SortedBindingList(Of AnoLectivo)(_originalList)
_sortedList.ApplySort("Name", System.ComponentModel.ListSortDirection.Ascending)
bindingSourceCustomers.DataSource = _sortedList

" Also, make sure the controls are bound to the binding source"
they are...



ajj3085 replied on Wednesday, July 26, 2006

So does it work if the orginal object is bound to the binding source?  What about to the grid?  Just trying to think if its the bindingsource causing your problems or something else..

vitorsilva replied on Wednesday, July 26, 2006

if i bind the original object to the binding source and set the grid's datasource to that binding source everything works fine.
if i bind the sorted object to the binding source and set the grid's datasource to that binding source i don't get the validation errors


DogSpots replied on Thursday, July 27, 2006

I'm having the same problem.  I'm trying to trace it right now.  I'll let you know if I find anything; please do the same.

DogSpots replied on Monday, July 31, 2006

I was unable to find anything.

vitorsilva replied on Thursday, September 14, 2006

this article http://forums.lhotka.net/forums/thread/4194.aspx helped me.

Copyright (c) Marimer LLC