Hi!
I have a form with an UltraGrid wich columns have been set at design time, I also have a BindingSource assigned to the grid's DataSource. I create manually each column, and then Add a Range of this columns. The problem is when I assign the BindingSource to the DataSource, the collection of columns that I seted up in design view is replaced with the columns of the BindingSource. What I want is that the Grid keeps the columns I set and only assign the data that I am passing to it. Is any property that help my do this? (I guess it should exists a property like AutoGenerateColumns that can be set to false, but I cant find something like this... :S)
Greetings!
HOWTO:How can I define columns in the grid at Design-time and bind them at run-time so that some fields of the data are excluded from the grid?
Hi Mike!
I've proved the solution and it works ... :) now when I bind the data it doesn't appear new columns, however, I have created another columns besides the ones who exists in the binding source schema, and this columns disappear when I call the SetDataBinding function. The article you post says that all columns have to match the actual data source, do you know any way to keep all the columns of the schema, even the ones that doesn't have association with a field in the data source?
You should not lose unbound columns when you bind the grid. That sounds like a bug. Are you using the latest Hot Fix of the grid?
I'm using Infragistics 2007 Volume 1 CLR 2.x Release (v7.1.20071.40)
with the HotFix 2007 Volume 1 CLR 2.x Hot Fix (v7.1.20071.1050.
The version of Infragistics2.Win.UltraWinGrid.v7.1 is 7.1.20071.1050.
vimaljonn said: There is a property of ultragrid: SetDataBinding(object datasource, datamember datamember, bool hidenewColumns). Ex: UltrawinGrid1.SetDataBinding(datasource1, null, true); If you set the hideNewColumns param to true, the grid won't generate all the columns but only the ones you've specified in the designer.
There is a property of ultragrid: SetDataBinding(object datasource, datamember datamember, bool hidenewColumns).
Ex: UltrawinGrid1.SetDataBinding(datasource1, null, true);
If you set the hideNewColumns param to true, the grid won't generate all the columns but only the ones you've specified in the designer.
That is not entirely accurate. The grid will not display the columns you left out design-time. They will be hidden. But they are still created by the grid and exist in the columns collection.
Hey Mike,
Hope that helps you help!
Cheers,
Marshal
Hi Luis,
That's not the most recent hot fix, there was a newer one released back in December. So you might want to try that and see if it helps.
How are you adding the unbound columns? I think if you add these columns as part of the data structure, then they might be removed or hidden, since they do not actually exist in the data source when you bind the grid. You might need to add them to the grid band, rather than the data layout.
Personally, I find it much easier to handle the InitializeLayout event of the grid and add any unbound columns I need at run-time.