14 January 2011

.NET - Decorate object properties for data binding

If you set the AutoCreateColumns property of a DataGridView to True, all public properties of a bound object type will appear as columns. However, you can manipulate how they appear by decorating these properties.

Using [Browsable(false)], the property will not be added as a column.

Using [DisplayName("The header text")], you set the column header text for the property.

No comments:

Post a Comment