New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial

A column type for the RadGrid control that is bound to a field in a data source.

The default data binding (when AutoGenerateColumns property is set to true) generates GridBoundColumn type of columns. It displays each item from the DataSource field as text. This column is editable (implements the IGridEditableColumn interface) and provides by default GridTextColumnEditor, used for editing the text in each item.

GridBoundColumn has three similar and yet different properties controlling its visibility and rendering in a browser in regular and in edit mode:

  • Display - concerns only the appearance of the column in browser mode, client-side. The column will be rendered in the browser but all the cells will be styled with display: none. The column editor will be visible in edit mode.
  • Visible - will stop the column cells from rendering in browser mode. The column will be visible in edit mode.
  • ReadOnly - the column will be displayed according to the settings of previous properties in browser mode but will not appear in the edit-form.
    None of these properties can prevent you from accessing the column cells' content server-side using the UniqueName of the column.

Definition

Namespace:Telerik.Web.UI

Assembly:Telerik.Web.UI.dll

Syntax:

C#
[SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable")]
public class GridBoundColumn : GridEditableColumn, IStateManager, IComparable, IGridEditableColumn, IGridDataColumn

Inheritance: objectGridColumnGridEditableColumnGridBoundColumn

Derived Classes: GridDateTimeColumnGridHTMLEditorColumnGridMaskedColumnGridNumericColumn

Implements: IComparableIGridDataColumnIGridEditableColumnIStateManager

Inherited Members GridEditableColumn.SetDefaultColumnEditor(IGridColumnEditor)GridEditableColumn.GetEditableColumn()GridEditableColumn.ShouldExtractValues(GridEditableItem)GridEditableColumn.ConvertValueIfEmpty(string)GridEditableColumn.GetActiveDataField()GridEditableColumn.ColumnEditorIDGridEditableColumn.MobileEditorGridEditableColumn.CurrentColumnEditorGridEditableColumn.InnerColumnEditorGridEditableColumn.ColumnEditorGridEditableColumn.ConvertEmptyStringToNullGridEditableColumn.UseNativeEditorsInMobileModeGridEditableColumn.DefaultInsertValueGridEditableColumn.ReadOnlyGridEditableColumn.InsertVisiblityModeGridEditableColumn.ForceExtractValueGridEditableColumn.AllowSortingGridEditableColumn.SortableGridEditableColumn.AllowFilteringGridColumn.ShouldSerializeFilterImageUrl()GridColumn.ShouldSerializeSortAscImageUrl()GridColumn.ShouldSerializeSortDescImageUrl()GridColumn.RefreshCurrentFilterValue(GridFilteringItem, string)GridColumn.RefreshCurrentFilterValue(GridFilteringItem)GridColumn.SetCurrentFilterValueToControl(TableCell)GridColumn.GetCurrentFilterValueFromControl(TableCell)GridColumn.EvaluateFilterExpression(GridFilteringItem)GridColumn.EvaluateFilterExpression()GridColumn.FunctionTakesNoArguments(GridKnownFunction)GridColumn.SetupFilterControls(TableCell)GridColumn.GetFilterFunctionsList(GridFilterListOptions, ArrayList)GridColumn.PrepareCell(TableCell, GridItem)GridColumn.LoadViewState(object)GridColumn.OnColumnChanged()GridColumn.SaveViewState()GridColumn.TrackViewState()GridColumn.ResetCurrentFilterValue(GridFilteringItem)GridColumn.ResetCurrentFilterValue()GridColumn.IsUniqueName(string)GridColumn.GenerateUniqueNameBase(string)GridColumn.TrySetOnClientClickScript(Control, GridItem, string, params string[])GridColumn.UpdateUniqueNameIfDefault(string)GridColumn.HeaderTooltipGridColumn.HeaderAbbrGridColumn.HeaderAxisGridColumn.SortedBackColorGridColumn.CurrentFilterValueGridColumn.AndCurrentFilterValueGridColumn.ColumnGroupNameGridColumn.SelectedGridColumn.SelectableGridColumn.CurrentFilterFunctionGridColumn.AndCurrentFilterFunctionGridColumn.FilterDelayGridColumn.ExportableGridColumn.EnableHeaderContextMenuGridColumn.ShowFilterIconGridColumn.FilterListOptionsGridColumn.AutoPostBackOnFilterGridColumn.FilterImageToolTipGridColumn.FilterControlToolTipGridColumn.EditorControlToolTipGridColumn.FilterImageUrlGridColumn.SortAscImageUrlGridColumn.SortDescImageUrlGridColumn.DataTypeNameGridColumn.ListOfFilterValuesGridColumn.FilterTemplateGridColumn.TableViewSpecificStateGridColumn.DesignModeGridColumn.FooterStyleGridColumn.FooterTextGridColumn.HeaderImageUrlGridColumn.HeaderStyleGridColumn.HeaderTextGridColumn.IsTrackingViewStateGridColumn.ItemStyleGridColumn.OwnerGridColumn.SortExpressionGridColumn.GroupByExpressionGridColumn.ViewStateGridColumn.ShowSortIconGridColumn.ShowNoSortIconGridColumn.VisibleGridColumn.DisplayGridColumn.OwnerIDGridColumn.OwnerGridIDGridColumn.ResizableGridColumn.ReorderableGridColumn.GroupableGridColumn.ColumnTypeGridColumn.HeaderButtonTypeGridColumn.OrderIndexGridColumn.IsDefaultUniqueNameGridColumn.EditFormColumnIndexGridColumn.UniqueNameGridColumn.EditFormHeaderTextFormatGridColumn.DataTypeGridColumn.FilterControlWidthGridColumn.FilterControlAltTextGridColumn.FilterCheckListWebServiceMethodGridColumn.FilterCheckListEnableLoadOnDemandobject.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()object.GetType()object.MemberwiseClone()...

Example:

            <telerik:GridBoundColumn FooterText="BoundColumn footer" UniqueName="CustomerID" SortExpression="CustomerID"
HeaderText="Bound<br/>Column" DataField="CustomerID">
</telerik:GridBoundColumn>

Constructors

C#
[SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable")]
public GridBoundColumn()

Fields

C#
[SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
protected string formatting
C#
public static readonly string thisExpr

Properties

Gets or sets the field name from the specified data source to bind to the GridBoundColumn.

C#
public virtual GridAggregateFunction Aggregate { get; set; }
Property Value:

A string, specifying the data field from the data source, from which to bind the column.

Gets a reference to the GridColumnValidationSettings object that allows you to set the properties associated with the columns' validation base on autogenerated validators.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
[SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable")]
public GridColumnValidationSettings ColumnValidationSettings { get; }

Gets or sets the field name from the specified data source to bind to the GridBoundColumn.

C#
public virtual string DataField { get; set; }
Property Value:

A string, specifying the data field from the data source, from which to bind the column.

Gets or sets the string that specifies the display format for items in the column.

C#
public virtual string DataFormatString { get; set; }
Property Value:

A string that specifies the display format for items in the column

Use the DataFormatString property to provide a custom format for the items in the column.

The data format string consists of two parts, separated by a colon, in the form { A : Bxx }.
For example, the formatting string {0:C2} displays a currency formatted number with two decimal places.

Note: The entire string must be enclosed in braces to indicate that it is a format string and not a literal string. Any text outside the braces is displayed as literal text.

The value before the colon (A in the general example) specifies the parameter index in a zero-based list of parameters.

Note: This value can only be set to 0 because there is only one value in each cell.

The value before the colon (A in the general example) specifies the parameter index in a zero-based list of parameters.

The character after the colon (B in the general example) specifies the format to display the value in. The following table lists the common formats.

Format character

Description

C

Displays numeric values in currency format.

D

Displays numeric values in decimal format.

E

Displays numeric values in scientific (exponential) format.

F

Displays numeric values in fixed format.

G

Displays numeric values in general format.

N

Displays numeric values in number format.

X

Displays numeric values in hexadecimal format.

Note: The format character is not case-sensitive, except for X, which displays the hexadecimal characters in the case specified.

The value after the format character (xx in the general example) specifies the number of significant digits or decimal places to display.

For more information on formatting strings, see Formatting Overview (external link to MSDN library).

Sets or gets default text when column is empty. Default value is "&nbsp;"

C#
public virtual string EmptyDataText { get; set; }

Gets or sets the footer aggregate format string.

C#
public virtual string FooterAggregateFormatString { get; set; }
Property Value:

The footer aggregate format string.

Sets or gets whether cell content must be encoded. Default value is false.

C#
public virtual bool HtmlEncode { get; set; }

Gets a boolean value, indicating whether the column is editable. A ReadOnly column will return a false value for this property. The property is readOnly.

C#
public override bool IsEditable { get; }
Property Value:

A boolean value, indicating whether the column is editable

Overrides: GridColumn.IsEditable

Gets or Sets an integer, specifying the maximum number of characters, which will be accepted in the edit textbox for the field, when in edit mode.

C#
public virtual int MaxLength { get; set; }
Property Value:

An integer, specifying the maximum number of characters, which the item will accept when in edit mode.

Methods

Creates a copy of the current column.

C#
public override GridColumn Clone()
Returns:

GridColumn

Overrides: GridColumn.Clone()

Note: When implementing/overriding this method be sure to call the base member or call CopyBaseProperties to be sure that all base properties will be copied accordingly

C#
protected override void ColumnEditorChange(IGridColumnEditor newValue)
Parameters:newValueIGridColumnEditor

Overrides: GridEditableColumn.ColumnEditorChange(IGridColumnEditor)

C#
protected override void CopyBaseProperties(GridColumn fromColumn)
Parameters:fromColumnGridColumn

Overrides: GridEditableColumn.CopyBaseProperties(GridColumn)

C#
protected override IGridColumnEditor CreateDefaultColumnEditor()
Returns:

IGridColumnEditor

Overrides: GridEditableColumn.CreateDefaultColumnEditor()

Extracts the values from the editedItem and fills the names/values pairs for each data-field edited by the column in the newValues dictionary.

C#
public override void FillValues(IDictionary newValues, GridEditableItem editableItem)
Parameters:newValuesIDictionary

dictionary to fill. This param should not be null (Nothing in VB.NET)

editableItemGridEditableItem

the GridEditableItem to extract values from

Overrides: GridEditableColumn.FillValues(IDictionary, GridEditableItem)

C#
protected virtual string FormatDataValue(object dataValue, GridItem item, bool formatEvenIfReadOnly)
Parameters:dataValueobjectitemGridItemformatEvenIfReadOnlyboolReturns:

string

C#
protected virtual string FormatDataValue(object dataValue, GridItem item)
Parameters:dataValueobjectitemGridItemReturns:

string

C#
protected override string GenerateUniqueName()
Returns:

string

Overrides: GridColumn.GenerateUniqueName()

This method should be used in case you develop your own column. It returns the full list of DataFields used by the column. GridTableView uses this to decide which DataFields from the specified DataSource will be inlcuded in case of GridTableView.RetrieveAllDataFields is set to false.

C#
public override IDictionary GetCustomPropertyDataFields(object dataItemInstance)
Parameters:dataItemInstanceobjectReturns:

IDictionary

Overrides: GridColumn.GetCustomPropertyDataFields(object)

Calculate the default Group-by expression based on the settings of the DataField (if available)

C#
public override string GetDefaultGroupByExpression()
Returns:

string

Overrides: GridColumn.GetDefaultGroupByExpression()

For example, if a column's DataField is ProductType the default group-by expression will be: 'ProductType Group By ProductType'

C#
protected override string GetFilterDataField()
Returns:

string

Overrides: GridColumn.GetFilterDataField()

Resets the GridBoundColumn to its initial state.

C#
public override void Initialize()

Overrides: GridColumn.Initialize()

Resets the specified cell in the GridBoundColumn to its initial state.

C#
public override void InitializeCell(TableCell cell, int columnIndex, GridItem inItem)
Parameters:cellTableCellcolumnIndexintinItemGridItem

Overrides: GridColumn.InitializeCell(TableCell, int, GridItem)

This method returns true if the column is bound to the specified field name.

C#
public override bool IsBoundToFieldName(string name)
Parameters:namestring

The name of the DataField, which will be checked.

Returns:

bool

Overrides: GridColumn.IsBoundToFieldName(string)

This method should be used in case you develop your own column. It returns true if the column supports filtering.

C#
public override bool SupportsFiltering()
Returns:

bool

Overrides: GridColumn.SupportsFiltering()