Hi,
I have a custom object that inherits from BindingList<T>, it has several properties and I wish to bind it to the grid.
This is all good, but what if I don't want 5 out of the 10 properties to be bound and shown in the grid, how do I go about doing this?
I have setup the columns at design-time so the column headers are correct like, 'Security Code' instead of 'SecurityCode', (with a space), but when I bind to the grid it still adds the properties to the grid, even though I haven't specified them at design-time. Can this be overriden?
I don't want to have to hide each column after it's been bound, otherwise one would have to remember when a new property is added to this custom object, the code that binds the object to the grid must be updated to stop the new property from showing up on the gird.
Cheers,
Pete.
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?
Mike,
When the column chooser is enabled, it shows all columns in the datasource, now I'm using SetDataBinding, the grid appears fine, but the column chooser should only show columns that are defined in the schema....
Is this a bug?
Nope, it's not a bug. The columns still exist in the grid - there is no way to remove them, they are only hidden. You can hide them from the ColumnChooser, though, using the ExcludeFromColumnChooser property of the column.