Hi, All,
I just converted my window application from .Net 1.1 to .Net 2.0 and I use Csla1.5.3 instead of old Csla1.4.x. ( I don't have time to rewrite business object to Csla2.1 now, just want my application can run under .net 2.0.) I modified my application and it compiles without errors and warnings.
But I get runtime exception when I run it. the problem is to bind the object to grid.
Me.grdAnswerResponse.DataSource = m_obj
the m_obj is collection of objects and its count is 0 at first time when the form is loaded. the error message is "An exception of type 'System.InvalidOperationException' occurred in CSLA.Core.Bindablebase.dll but was not handled in user code. Additional information: Adding items not allowed" I trace the code and find source code is at BindableCollectionBase under csla.core.bindablebase dll.
public
event ListChangedEventHandler ListChanged}remove{
if (value.Method.IsPublic && (value.Method.DeclaringType.IsSerializable || value.Method.IsStatic))_serializableHandlers = (ListChangedEventHandler)Delegate.Remove(_serializableHandlers, value);
else
_nonSerializableHandlers = (ListChangedEventHandler)Delegate.Remove(_nonSerializableHandlers, value);
}
}
The red color code will call the below method and throw the exception. I checked and know the code is almost same as Cals1.4.x. Why it won't have error message popup under my application .Net1.1 even it throws exception too under csla1.4.x? I didn't modify any code for this part but I get the error under Csla1.5.3
object
IBindingList.AddNew()The same code won't have any problem under csla.1.4.x. If the m_obj's count is not zero, it won't have the exception. How could I fix it and am I missing something? Thank you!
Brian
ajj3085,
No, it is not a readonly list, it inherits from BusinessCollectionBase(Cals.1.5.3) I only set AllowSort = true. I can not find the detail info for the difference between csla.1.4.x and csla.1.5.3. I thini it will help me if i can find it.
Thanks.
Brain
No, I don't have this.AllowNew = true; I only set AllowSort = true. Why I need this line? BTW, when the m_obj is not empty, it is ok.
I checked my application under Csla1.4.x, it throws the exception too but there is not popup exception winodw under .Net1.1. but under .Net2.0, it follows the some codes and gives exception.
thanks for your help
Brian
Thanks all you guys' help.
I use the Infragistic Grid control and find a similar problem. the link is at http://forums.lhotka.net/forums/thread/1993.aspx
Like Dawn suggestion "try not to bind the CSLA collection directly to the Infragistics Grid, using a BindSource Component instead. And set the BindSouce Componet's DataSouce to you CSLA collection." It works for me and not exception popups. but I get another problem that related to Infragistic, I may need to upgrade Infragistic. Now, I'm using Infragistic5.3.
Thanks
Brian
Copyright (c) Marimer LLC