AlanD wrote:
Thanks Frans,
Yes, e.Row.ListObject will cast to ActivityDateEntity as that is its type.
We're saying that it isn't possible to use IDataErrorInfo because the underlying source isn't based on any sort of DataTable.
Huh?
Every entity implements IDataErrorInfo, so you can cast an entity to IDataErrorInfo and call the IDataErrorInfo methods...
I realised that one of my (probably many!) confusions is that I was considering an UltraGrid.Row and a DataTable.Row to be almost the same thing and of course they aren't; the UltraGrid.Row is geared around display - the real data (and the error information) is in DataTable.Row which is absent in this case.
No!. There's no datatable, a datatable has nothing to do with it, you cast to DataRowView which is wrong as the data object is an entity, so change that and everything is fine. I got confused because you were casting to a DataRowView and I thought you had bound a datatable to the grid, but your code simply had a wrong cast.
There's NO datatable anywhere, just forget about datatables in this case, you're working with entity classes.
The cast error you got can have two different causes:
- Your routine is correct and you bound the wrong object
- Your routine is wrong (it casts to the wrong type) and you bound the correct object (this is your situation).
I thought of option 1, hence my questions about datatables. As it's option 2, forget about datatables. LLBLGen Pro doesn't use datatables in entities.
If it's not possible to use IDataErrorInfo and the associated DataRowView, is there another way?
There's no dataview/datarowview or datatable. there's an entity and it implements IDataErrorInfo, please see the reference manual.