Ertan Deniz
|
|
Group: Forum Members
Posts: 163,
Visits: 493
|
I have list of services (Object) in my grid. I've added a record (Services Object) on different page. Then, refresh the grid when I came to Grid page. I have got the error below. An error occurred while refreshing the data from field 'Services.unitset_id' to property 'SelectedValue' on control 'editUnitSet.' When I open the page from menu. I have seen the added record.
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
You haven't provided enough information for me to help you diagnose your problem. Please post a stack trace and/or a quick sample that reproduces your problem. Thanks.
|
|
|
Ertan Deniz
|
|
Group: Forum Members
Posts: 163,
Visits: 493
|
Sorry. Last week was my holiday week. I've tested my screen and I had no error for the above condition. It might be under specific conditions. If I find that case, I 'll inform you.
|
|
|
Ertan Deniz
|
|
Group: Forum Members
Posts: 163,
Visits: 493
|
I've encountered with same error. In my form ; There is a grid which lists the objects (called Services). and There are UI controls which shows the current object's properties. (Current object is selected on the grid.) If Business Object has no records. (After a query) I've got the error below ; "An error occurred while refreshing the data from field 'Services.unitset_id' to property 'SelectedValue' on control 'editUnitSet.'" editUnitSet is a combobox and populated on formload from another Business Object. Since Business Object (Services Object) has no current record, and has no valid unitset_id as well. Binding mechanism goes on working. I've searched from help and found the topic ; What Happens to an Empty Business Object StrataFrame automatically removes all control bindings when the business object has no records. The instant the business object is populated with data, the bindings are automatically re-created and the presentation layer controls are updated. If so, why do I get the error ? What is wrong with my case ?
|
|
|
Ertan Deniz
|
|
Group: Forum Members
Posts: 163,
Visits: 493
|
Stack Trace of the above error : at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index) at MicroFour.StrataFrame.Business.BusinessLayer.RemoveBinding(Control ControlToRefresh, String PropertyName) at MicroFour.StrataFrame.Business.BusinessLayer.RefreshControl(IBusinessBindable ControlToRefresh, Boolean DataPresent)
|
|
|
Ertan Deniz
|
|
Group: Forum Members
Posts: 163,
Visits: 493
|
The error was related the parameters given in Listpopulating Event. Null control was missing. Now, when BusinessObject has no records, I'm not getting the error specified. I 've continued working on the form ; I 've requeried the object (which is bound to the grid and UI controls which show current object) with parameters that returns records . Object had records after query. I've got the new error. (See details) Type : System.InvalidCastException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Message : Specified cast is not valid. Source : Medin.Business.Materials.New HelpLink : TargetSite : Void SetValue(System.Object, System.Object) StackTrace : Medin.Business.Materials.Purchase.Services.Field_unitset_id_Descriptor.SetValue(Object component, Object Value) C:\Documents and Settings\ertan.deniz.KULLANICI\My Documents\Visual Studio 2005\Projects\Medin.Materials\Medin.Materials.Purchase.Business\Purchase\Objects\Services.Designer.cs:line 1235 System.Windows.Forms.BindToObject.SetValue(Object value) System.Windows.Forms.Binding.PullData(Boolean reformat, Boolean force) System.Windows.Forms.Binding.UpdateIsBinding() System.Windows.Forms.Binding.CheckBinding() System.Windows.Forms.Binding.SetListManager(BindingManagerBase bindingManagerBase) System.Windows.Forms.ListManagerBindingsCollection.AddCore(Binding dataBinding) System.Windows.Forms.BindingsCollection.Add(Binding binding) System.Windows.Forms.BindingContext.UpdateBinding(BindingContext newBindingContext, Binding binding) System.Windows.Forms.Binding.SetBindableComponent(IBindableComponent value) System.Windows.Forms.ControlBindingsCollection.AddCore(Binding dataBinding) System.Windows.Forms.ControlBindingsCollection.Add(Binding binding) MicroFour.StrataFrame.Business.BusinessLayer.AddBinding(Control ControlToRefresh, String PropertyName, String FieldName) MicroFour.StrataFrame.Business.BusinessLayer.RefreshControl(IBusinessBindable ControlToRefresh, Boolean DataPresent)
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
Well, there seems to be quite a bit going on, but the last error seems to be the easiest to dianose. It is a cast exception so that value that is being passing into the Set of the unitset_id field is not a type that can be converted into the type it is expecting. For example, this may be a integer field and character data is being passed into the Set of the property.
|
|
|
Ertan Deniz
|
|
Group: Forum Members
Posts: 163,
Visits: 493
|
I've attached the code clock below. I'm trying to fill the object. (FillDataTable) At this time, SetValue is running and I'm gettinng the error. (It is signed with red on the code block.) It is interesting that left side of the assignment has a value (valid unitsetid) but right side has null value. So, casting error. The object has values coming from DB. But there is an assignment (SetValue) which is trying to assign values on the object which is filled. Normally, After object has values coming from DB, binding mechanism will start. Why does SetValue run at this time ? What is the meaning of SetValue ? Is the order of assignment true ? I expect that right side must be left side ? Because, I'm displaying values from DB. Do you explain the process briefly ? Fill, Bind etc. private class Field_unitset_id_Descriptor : MicroFour.StrataFrame.Business.FieldPropertyDescriptor { public Field_unitset_id_Descriptor() : base("unitset_id") { } private System.Type _PropertyType = typeof(System.Int32); public override object GetValue(Object component) { return ((Services)component).unitset_id; } public override void SetValue(Object component, object Value) { ((Services)component).unitset_id = (Nullable<System.Int32>Value; (Error : Specified Cast is not valid.) } public override System.Type PropertyType { get { return this._PropertyType; } } public override System.Type ComponentType { get { return _ComponentType; } } }
|
|
|
Ertan Deniz
|
|
Group: Forum Members
Posts: 163,
Visits: 493
|
As a described above, I fill the object and get a list of records in the grid and current record on the form view. (UI controls) I couldn't get the error. Values are coming from DB and displayed on the form. (I don't have the error) But, Requery object and no records. This is also working. Requery object but there are records at this time. I 've got the error.
|
|
|
Ertan Deniz
|
|
Group: Forum Members
Posts: 163,
Visits: 493
|
|
|
|