GridView.AddUnboundColumn(String, String) Method
Creates an unbound column with the specified name and display caption and opens the Expression Editor to allow an end-user to specify an expression for the column.
Namespace: DevExpress.XtraGrid.Views.Grid
Assembly: DevExpress.XtraGrid.v24.2.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
columnName | String | A string to be assigned to the GridColumn.Name property. Must be a unique value. |
caption | String | The column’s display caption. This value is assigned to the GridColumn.Caption property. |
Returns
Type | Description |
---|---|
GridColumn | The created unbound column. null if an end-user didn’t specify an expression for the column. |
Remarks
The AddUnboundColumn method creates an unbound column and opens the Expression Editor to allow an end-user to specify an expression for the column. If the user specified an expression via this editor, the column is added to the View. Otherwise, the column is destroyed and the AddUnboundColumn method returns null.
The following properties are set by the AddUnboundColumn method:
- GridColumn.UnboundDataType to Object.
- OptionsColumn.AllowSort to DefaultBoolean.True.
- GridColumn.ShowUnboundExpressionMenu to true.
- GridColumn.UnboundExpression to the value entered by an end-user via the Expression Editor.
- GridColumn.Visible to true (if the user entered an expression via the Expression Editor; otherwise, the column is destroyed).
To manually invoke the Expression Editor for a column, use ColumnView.ShowUnboundExpressionEditor.