Skip to main content
A newer version of this page is available. .

EditorRow(String) Constructor

Creates a new EditorRow object and binds it to the specified datasource field.

Namespace: DevExpress.XtraVerticalGrid.Rows

Assembly: DevExpress.XtraVerticalGrid.v19.2.dll

Declaration

public EditorRow(
    string fFieldName
)

Parameters

Name Type Description
fFieldName String

A string value specifying the name of the data field to which the created row should be bound. Sets the RowProperties.FieldName property value.

Remarks

Use this constructor to programmatically create a new editor row bound to a specific data field. The constructor initializes the RowProperties.FieldName property with the parameter value. Other properties are set to their default values. If you need a new editor row to be created with default settings, you should use the constructor with no parameters.

You can use methods and properties of the newly created row object to adjust it as your application needs dictate: you can specify its name, caption, editor type, etc. The created editor row should be added to a row collection in order to be displayed. Row collections can be accessed via the VGridControlBase.Rows or the BaseRow.ChildRows property. These properties are represented by instances of the VGridRows object which provides methods to add and delete individual rows.

Example

The example below demonstrates how to create an editor row at runtime and bind it to a specific data field using a constructor with the fieldName parameter. The new editor row is intended to represent and edit values of the HP (horse power) data field. For this purpose, an editor of the SpinEdit type is used for the row. The example code adjusts the created row and adds it to the grid’s VGridControlBase.Rows collection.

During row adjustment the code sets the desired name and caption for the row and specifies an editor of the SpinEdit type for the row.

using DevExpress.XtraVerticalGrid;
using DevExpress.XtraVerticalGrid.Rows;

// creating a new editor row bound to a data field
EditorRow newEditorRow = new EditorRow("HP");

// assigning the name and caption to the created editor row
newEditorRow.Properties.Caption = "HP";
newEditorRow.Properties.FieldName = "HP";

// assigning the editor for the created editor row
newEditorRow.Properties.RowEdit = vGridControl1.RepositoryItems.Add("SpinEdit");

// appending the editor row to a collection of top level grid rows
vGridControl1.Rows.Add(newEditorRow);
See Also