On my form I have a UltraNumericEditor control. The control's value property is bound to a data table column (smallint) via Window.Forms.BindingSource.
The value contains some bitcoded status data, from which I initialize some checkboxes. If the control's visible property is set to false, the value property has no value (DBNull). Why? Is this a bug?
Regards
Markus
Hello Mac,
Thank you for contacting Infragistics.
Please answer the following questions for me.
Hello Dave,
VS2010, c# and NetAdvantage 11.1.20112.2050.
DataSet where controls are bound to, are filled up in the forms load event. Setting up the checkboxes from the hidden bound control happens in the form_show event.
Hello Markus,
Thank you for this information.
I believe you might have mistyped the version of NetAdvantage you are using, though. If you're using NetAdvantage 2011 Volume 1, the digit before the last period in the version number should be a 1. However, if you're using NetAdvantage 2011 Volume 2, the digit after the first period should be a 2. Please clarify which version it is you are using.
Sorry about that. The correct version is: 11.2.20112.2050
I tried this in the latest build of NetAdvantage 2011 Volume 2, but did not reproduce the issue. So that we're both on the same page, could you provide a sample project that reproduces the issue? You can attach a file to a post by selection the Options tab when editing your post.
Hallo Dave,
I don't have a small sample project with all things around to reproduce. But I wonder why you can not reproduce this.
Just tell me that visible state should not have any influence. If so, I have to use a workaround (set visible = false after setup the checkboxes).
I just can tell you that the problem NOT happens if I use a UltraTextEditor instead UltraNumericEditor binding the same data field.
If I use the UltraNumericEditor with visible = false at design time no value is bound. If I change visible = true in code, the value is bound. If I change visible back to false on the next line of code, the value is still bound. It seems that it only not works if the editor is of type UltraNumericEditor and visible = false at design time.
Hi Markus,
I have seen this happen for any control whose Handle is not yet created. The BindingManager in DotNet appears to ignore these controls. I assume the idea is that if the user cannot see the control, why bother wasting processing power on it.
In the past, I have gotten around this by forcing the creation of the handle for the control in question. You have to be very careful about this, though. Forcing the handle creation at the wrong time can cause some unexpected results which are very difficult to track down. So what I would do is expose a property or a method that gets the value from the control and inside this method, check the IsHandleCreated and if it's false, create the handle by calling CreateControl or Update on it, then return the Value.
I compared the Infragistics controls not the common toolbox controls. UltraTextEditor and UltraNumericEditor do not have the same behavior as I mentioned in my last post.
I believe this is expected behavior. If you'll try it with the System.Windows.Forms.TextBox control, you'll see that the control's Text property is never bound to the data if it is hidden at design time.