GridBoundColumn
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:
[SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable")]
public class GridBoundColumn : GridEditableColumn, IStateManager, IComparable, IGridEditableColumn, IGridDataColumn
Inheritance: objectGridColumnGridEditableColumnGridBoundColumn
Derived Classes:
Implements:
Inherited Members
Example:
<telerik:GridBoundColumn FooterText="BoundColumn footer" UniqueName="CustomerID" SortExpression="CustomerID"
HeaderText="Bound<br/>Column" DataField="CustomerID">
</telerik:GridBoundColumn>
Constructors
[SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable")]
public GridBoundColumn()
Fields
[SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
protected string formatting
Properties
Gets or sets the field name from the specified data source to bind to the GridBoundColumn.
public virtual GridAggregateFunction Aggregate { get; set; }
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.
[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.
public virtual string DataField { get; set; }
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.
public virtual string DataFormatString { get; set; }
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 " "
public virtual string EmptyDataText { get; set; }
Gets or sets the footer aggregate format string.
public virtual string FooterAggregateFormatString { get; set; }
The footer aggregate format string.
Sets or gets whether cell content must be encoded. Default value is false.
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.
public override bool IsEditable { get; }
A boolean value, indicating whether the column is editable
Overrides:
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.
public virtual int MaxLength { get; set; }
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.
public override GridColumn Clone()
Overrides:
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
protected override void ColumnEditorChange(IGridColumnEditor newValue)
Overrides:
protected override void CopyBaseProperties(GridColumn fromColumn)
Overrides:
protected override IGridColumnEditor CreateDefaultColumnEditor()
Overrides:
Extracts the values from the editedItem and fills the names/values pairs for each data-field edited by the column in the newValues dictionary.
public override void FillValues(IDictionary newValues, GridEditableItem editableItem)
dictionary to fill. This param should not be null (Nothing in VB.NET)
editableItemGridEditableItemthe GridEditableItem to extract values from
Overrides:
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.
public override IDictionary GetCustomPropertyDataFields(object dataItemInstance)
Overrides:
Calculate the default Group-by expression based on the settings of the DataField (if available)
public override string GetDefaultGroupByExpression()
Overrides:
For example, if a column's DataField is ProductType the default group-by expression will be: 'ProductType Group By ProductType'
Resets the GridBoundColumn to its initial state.
public override void Initialize()
Overrides:
This method should be used in case you develop your own column. It returns true if the column supports filtering.