Edit this page

BoundColumnBase

GridViewBoundColumnBase derives from GridViewColumn, which means it inherits all of the functionality too. In addition it allows you to easily bind data, format it and edit it using editors.

Here is a list of the most important properties and methods.

  • DataFormatString - allows you to specify formatting for the data displayed in the column via a format string. More about displaying data in the RadGridView here.

  • DataMemberBinding - allows you to specify the binding to the property, whose value you want to display in the column. More about displaying data in the RadGridView here.

  • EditorStyle - allows you to specify a Style for the editor of the column.

  • EditTriggers - allows you to specify what action will set the cell in edit mode.
    The available options are: CellClick, F2, None, etc.

  • FilteringControlStyle - allows you to specify a Style for the filtering control.

  • IsAutogenerated - indicates whether the column is auto generated or not.

  • IsReadOnlyBinding - defines which cells of the column should be read only. Read more here.

  • GetValueForItem(item) - a method which returns the content of the cell for the provided item.

Example 2: Iterating over cells in all visible columns and accessing their values.

var visibleColumns = RadGridView1.Columns.OfType<GridViewBoundColumnBase>()
                     .Where(c => c.IsVisible)
                     .OrderBy(c => c.DisplayIndex).ToList();
for (var i = 0; i < RadGridView1.Items.Count; i++)
{
    for (var j = 0; j < visibleColumns.Count; j++)
    {
        var value = visibleColumns[j].GetValueForItem(RadGridView1.Items[i]);
    }
}

For performance reasons, you should work with UniqueName of GridViewBoundColumnBase only when you have also configured DataMemberBinding for it. Otherwise, please define GridViewColumn and use Header property instead.

Was this article helpful? Yes No

Give article feedback

Tell us how we can improve this article

Dummy