Grid Refresh -Binding Error


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
OK...that makes more sense.
Ertan Deniz
Ertan Deniz
StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)
Group: Forum Members
Posts: 163, Visits: 493
I've developed a test a project. And seen that no problem at that case.

Original point in my project also have been tested and also no problem.

The problem may be related development environment (DLL versions etc).

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Ertan,

I don't see anything past an invalid cast exception.  Why can't you just return an alternate value on Null so that a valid value is returned to the grid?  I do not believe this to be a BBS or BO "bug" or "issue" but rather how it is designed.  If the control to which you are binding doesn't support a null value being returned, then you would want to ensure that it can be cast by supplying a valid value.  Just from looking at your code snippet and stack trace, this is what I would recommend.

Ertan Deniz
Ertan Deniz
StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)
Group: Forum Members
Posts: 163, Visits: 493
I think there is conflict or complication. What do you say the conflict with the message and code ?

The line from my code shows that unitset_id gets value.

((Services)component).unitset_id = (Nullable<System.Int32>Value; (Error : Specified Cast is not valid.)

But message says  control gets value ;

"An error occurred while refreshing the data from field 'Services.unitset_id' to property 'SelectedValue' on control 'editUnitSet.'"

 



Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
I have not had a change to look at this in depth.  I tried to re-produce the problem quickly, but had no issues.  Since I am going to have to take your code and try and reconstruct your issue, I have not had a chance to do this.  If you want to supply the sample, it may go faster.  But as of yet, I have not been able to reproduce nor have I spent an extended amount of time trying to reproduce since I couldn't reproduce it quickly.

So at present, this is on a list to look at, and it is something that we will try to look at prior to the final 1.6.6 build.  If you want to provide a sample showing the error versus just showing a code snippet, it will definitely speed up the process.

Ertan Deniz
Ertan Deniz
StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)
Group: Forum Members
Posts: 163, Visits: 493
Any Comment ?
Ertan Deniz
Ertan Deniz
StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)
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
Ertan Deniz
StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)
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>WinkValue; (Error : Specified Cast is not valid.)
            }
            public override System.Type PropertyType
            {
                get
                {
                    return this._PropertyType;
                }
            }
            public override System.Type ComponentType
            {
                get
                {
                    return _ComponentType;
                }
            }
        }

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
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
Ertan Deniz
StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)
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)

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search