GridDropDownColumn
Displays a DropDown control for each item in the column. This allows you to edit for example lookup field(s) from data table(s).
Here is the mechanism which Telerik RadGrid uses to present values for GridDropDownColumn. Consider the snippet below:
<radg:GridDropDownColumn
UniqueName="LevelID"
ListDataMember="Level"
ListTextField="Description"
ListValueField="LevelID"
HeaderText="LevelID"
DataField="LevelID"
/>
As you can see, a requirement for the proper functioning of GridDropDownColumn is that all column values referenced by the DataField attribute match the column values referenced by the ListValueField attribute.
If there are values in the LevelID column of the LevelID table which do not have corresponding equal values in the LevelID column of the Level table, then the grid will display the default first value from the Description column as it will not "know" what is the correct field.
Definition
Namespace:Telerik.Web.UI
Assembly:Telerik.Web.UI.dll
Syntax:
[SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable")]
public class GridDropDownColumn : GridEditableColumn, IStateManager, IComparable, IGridEditableColumn, IGridDataColumn
Inheritance: objectGridColumnGridEditableColumnGridDropDownColumn
Implements:
Inherited Members
Constructors
public GridDropDownColumn()
Properties
Gets or sets a value indicating whether automatic load-on-demand is enabled for the RadComboBox editor of this column.
public bool AllowAutomaticLoadOnDemand { get; set; }
Gets or sets a value indicating whether virtual scrolling is enabled for RadComboBox editor. Setting this property to true requires AllowAutomaticLoadOnDemand to be set to true
public bool AllowVirtualScrolling { get; set; }
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)]
public GridColumnValidationSettings ColumnValidationSettings { get; }
The DataField property points to the column in the grid data-source containing values which will be compared at a later stage with the values available in the column, referenced by the %ListValueField:ListValueField% property.
public string DataField { get; set; }
A string, specifying the ID of the datasource control, which will be used to populate the dropdown with data.
public string DataSourceID { get; set; }
A string, specifying the ID of the datasource control, which will be used to populate the dropdown with data.
Gets or sets the type of the dropdown control associated with the column.
public GridDropDownColumnControlType DropDownControlType { get; set; }
Returns a value from the GridDropDownColumnControlType enumeration; default value is RadComboBox.
A string, specifying the text to be displayed in normal mode, when there is no Data Source specified for the column. In edit mode, this value is rendered as a dropdown list item. When in edit mode, and there is a valid DataSource specified for the control, this value is appended as the first item of the dropdown box.
public string EmptyListItemText { get; set; }
A string, specifying the text to be displayed in normal/edit mode, when there is no Data Source specified for the column.
A string value, representing the value, associated with the EmptyListItemText.
public string EmptyListItemValue { get; set; }
A string value, representing the value, associated with the EmptyListItemText.
A Boolean value, indicating whether the dropdown column will be bound to a default value/text when there is no data source specified, from which to fetch the data.
public bool EnableEmptyListItem { get; set; }
A Boolean value, specifying whether the dropdown column accepts EmptyListItemText and EmptyListItemValue strings.
protected virtual DropDownList InnerList { get; }
A Boolean value, indicating whether a dropdown column is editable. If it is editable, it will be represented as an active dropdown box in edit mode.
public override bool IsEditable { get; }
A Boolean value, indicating whether a dropdown column is editable.
Overrides:
Gets or sets the number of Items the RadComboBox editor will load per Item request. This property requires EnableAutomaticLoadOnDemand to be set to true.
public int ItemsPerRequest { get; set; }
Set this property to -1 to load all Items when AllowAutomaticLoadOnDemand is set to true and disable Virtual Scrolling/Show More Results. The default is -1.
The ListDataMember property points to the data table (part of the dataset used for grid data-source) which is the source for the GridDropDownColumn generation.
public string ListDataMember { get; set; }
The ListTextField points to the column in the data table from which the grid will extract the values for the dropdown.
public string ListTextField { get; set; }
Gets or sets the drop down control DataTextFormatString value.
public string ListTextFormatString { get; set; }
The drop down control DataTextFormatString value.
The ListValueField points to the column in the data table which will be used as a pointer to retrieve the items for the dropdown in the GridDropDownColumn.
public string ListValueField { get; set; }
Gets or sets a value indicating whether the RadComboBox editor displays a More Results box. Setting this property to true requires AllowAutomaticLoadOnDemand to be set to true.
public bool ShowMoreResultsBox { get; set; }
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:
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'