We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

InternalColumns not set when binding

I am setting a GDBG''s DataSource and DataMember properties but the InternalColumns has no columns. I am not setting GridBoundColumns. The funny thing is, this used to work and as far as I can see so far, nothing has changed which should affect it.

9 Replies

AD Administrator Syncfusion Team October 4, 2005 02:39 PM UTC

You can try calling grid.Binder.InitializeColumns after setting teh DataSource to see if this makes things work for you. If not, if you upload a sample showing the problem, we can try to debug it here.


HG Hamish Gunn October 4, 2005 03:28 PM UTC

Thanks, I tried that but it didn''t work. I''ve pinned it down to what has changed. In order to standardise our look and feel, we have created a superclass form, from which we inherit. e.g. instead of: Inherits System.Windows.Forms.Form we have: Inherits SkinnedForm SkinnedForm is a simple System.Windows.Forms.Form with a DirectSkin OCX on it. There are some methods to allow us to set up, turn on and off the "skinning". Even if I do not call any of these methods, my InternalColumns are not set. However, as soon as I remove the superclassing to SkinnedForm, everything works. I made my form inherit from a standard plain-vanilla form and everything works. So it looks as though the presence of the DirectSkin OCX is having some effect. Any ideas why simply the presence of an OCX should do this (I have not called any of its methods)?


AD Administrator Syncfusion Team October 4, 2005 03:38 PM UTC

Is the parent of the grid any different between the situation that works and the one that does not? Is the grid parented to this OCX? You might check the BindingContext property of grid to make sure it is set properly, maybe set it directly to the form.BindingContext.


HG Hamish Gunn October 4, 2005 03:57 PM UTC

>Is the parent of the grid any different between the situation that works and the one that does not? Is the grid parented to this OCX? > No and no. >You might check the BindingContext property of grid to make sure it is set properly, maybe set it directly to the form.BindingContext. > The help for BindingContext is broken so I don''t know how to go about setting an appropriate BindingContext. (Sorry, no topics were found for the selected link. Keywords = "" IndexMoniker = "!DefaultAssociativeIndex" Source URL = "ms-help://Syncfusion/sfClassRef/html/SyncfusionWindowsFormsGridGridModelDataBinderClassBindingContextTopic_5d8b9d23.html" )


AD Administrator Syncfusion Team October 4, 2005 04:09 PM UTC

BindingContext is inherited from the Control.BindingContext property. Syncfusion does not do anything with it except use it, so there is no Syncfusion specific help on this framework property. Try setting: myGrid.BindingContext = myForm.BindingContext. So, if you comment out your OCX code in that base class, everything works. If you only uncomment out the creation of the OCX object, the grid fails to initialize? Is this correct? If you have our source code, you can build a debug version of our libraries using our Assembly Manager, and try stepping through the initialializing process to see why the InternalColumns are not being set. Or, if you can upload a sample that shows the problem, we can try debugging it here.


HG Hamish Gunn October 5, 2005 02:23 PM UTC

I''ve tried to create a simple example. There are 4 variations: No OCX, No Docking (i.e. no Docking Manager) OCX, No Docking No OCX, Docking OCX, Docking The latter 2 do not set the Grid''s InternalColumns, so I''m left to conclude that docking is the problem really. So I set the Grid''s BindingContext to the form''s BindingContext and that seemed to work. However, my problem in the ''live'' code is that I have an arbitrary grid since this is utility code and may be used anywhere. How do I get to the form say, if my Grid''s parent is a panel under control of Docking Windows? I tried going up the parent list until I came to a form, but this does not work beyond the panel when using Docking Windows.


AD Administrator Syncfusion Team October 5, 2005 02:44 PM UTC

Try setting: myGrid.BindingContext = new BindingContext(); instead of setting it to the parent form''s.


HG Hamish Gunn October 5, 2005 03:35 PM UTC

OK thanks - that seemed to work. Is this behaviour a bug with the combination of Docking Windows and Data Bound Grids?


AD Administrator Syncfusion Team October 5, 2005 04:42 PM UTC

I do not think so. When you dock/undock a window, the parent of the docked window is changed. It is the changing of the parent that is stepping on the previously set BindingContext.

Loader.
Live Chat Icon For mobile
Up arrow icon