Column Properties

Top  Previous  Next

Basic Properties

ColumnExpression

This property defines the expression that represents the column in the grid. In most cases this is simply the column name but can also be a more complex SQL expression that is supported by the database

Run Sample

Label

Defines the text label displayed against the column. Defaults to the value in the ColumnName property

Run Sample

PrimaryKey

For a grid to be editable or to act as a parent to a child control it is necessary for at least one column to be designated as a PrimaryKey. For multi-part primary keys every column that constitutes the key must have the PrimaryKey property set. In many cases DbNetGrid is able to automatically detect that a column is a PrimaryKey and will set this property automatically.

Run Sample

Additional Properties

Aggregate

The Aggregate property specifies that an aggregate value for the column should be displayed in an aggregate row at the foot of the grid. Possible values are Sum, Avg, Min, Max and Count.

Run Sample

AutoIncrement

Indicates that the column value is auto-incrementing and therefore read-only. In the case of some columns such as SQL Server Identity columns this property is set automatically.

BaseTableName

When using a view as a data source the BaseTableName property can be used to indicate the name of the underlying table associated with the column

BooleanDisplayMode

This property determines how a boolean database value is displayed in the grid. Possible values are Checkbox, TrueFalse and YesNo.

Run Sample

ColumnName

The name of the column as assigned by the database based on the ColumnExpression. The property is read-only.

Display

Indicates that a column is not displayed in the grid. Used for columns that are editable or searchable but not to be displayed.

Run Sample

Edit

Indicates that a column is or is not editable. The default is true.

Run Sample

EditControlType

The EditControlType property allows you to manually specify the type of control used to edit the database value. A default value is assigned based on the type and size of the database column. For example, an EditControlType of Html will make the editor an HTML Editor rather than the default Text editor for a text column.

Edit Control Types

Auto

Control type is automatically assigned based on the underlying database column. Default.

TextBox

Single-line text box

TextBoxLookup

Text box with a lookup button that opens a list selection dialog. Requires the Lookup property to be assigned.

TextBoxSearchLookup

Text box with a lookup button that opens a list selection dialog that searches data defined by the Lookup property to be assigned.

CheckBox

Forces a field to act as a boolean type

Html

Edits HTML content with WYSIWYG HTML editor. The HTML editor can be customised using the onBeforeTinyMceInit event.

DropDownList

Drop-down list of values specified by the Lookup property.

RadioButtonList

Radio button list of values specified by the Lookup property.

ListBox

Multi-line list of values specified by the Lookup property.

Label

Displays data in a read-only label

TextArea

Multi-line text box

Password

Password field where field contents are obscured

SuggestLookup

Google suggest style lookup searching values specified by the Lookup property.

 

Run Sample

EditFormat

Specifies an edit format mask if different from the display Format property. Values are the standard .NET date-time and numeric formatting strings.

Run Sample

EditLookup

Specifies a lookup for an edit column when different from the Lookup property.

EditMaxThumbnailHeight

Specifies the maximum height of an image associated with a column when displayed as a thumbnail in the edit dialog. The width of the image is scaled in proportion to the height.

EditStyle

Allows CSS style attributes to be assigned to an edit field.

Run Sample

Filter

Indicates that the column has a drop-down filter in the grid header.

Run Sample

ForeignKey

Indicates that the column is acting as a foreign key in a child grid (either linked or nested). A ForeignKey column is paired with a PrimaryKey column in the parent control in order to establish the relationship between the 2 controls.

Run Sample

Format

Specifies a format mask for a date-time or numeric value.  Values are the standard .NET date-time and numeric formatting strings. Use the EditFormat property to specify a distinct format string for the editable value.

Run Sample

InsertReadOnly

Specifies that the column cannot be edited when a record is being added.

IsBoolean

Specifies that the column should behave like a boolean (bit) column (accepting only true/false). Some databases do not have a dedicated boolean type and with this property you can make a different data type such as small integer act like a boolean database type.

Lookup

The Lookup property is used to convert a value to/from its descriptive value typically held in a separate database table. The Lookup property is specified as an SQL statement that selects 2 columns. The first column is the foreign key column that is matched against the column value and the second value is the descriptive value. The Lookup property is used when displaying a grid value, searching against the value and editing the value.

Run Sample

The way a lookup is implemented in the Edit Dialog can be controlled by setting the EditControlType property to one of the following values DropDownList (default), TextBoxLookup, SuggestLookup, TextBoxSearchLookup, ListBox or RadioButtonList

Run Sample

A Lookup can also be defined using a string of values defined in JSON array format.

Run Sample

LookupSearchMode

The LookupSearchMode property is used to indicate if the search (via the search dialog) should be made directly against the column value or indirectly against the descriptive text as defined by the Lookup property. Possible values are SearchText or SearchValue.

Run Sample

MaxThumbnailHeight

Specifies the maximum height of an image associated with a column when displayed as a thumbnail in the grid. The width of the image is scaled in proportion to the height.

Run Sample

ReadOnly

Indicates if a field is read-only in both insert and update mode. The column is displayed in the edit dialog but the value cannot be altered.

Required

When set to true then a value must be entered when editing the value

Run Sample

Search

Indicates if a column is searchable (via the search dialog). Default is true.

SequenceName

Specifies the name of an Oracle sequence or Firebird generator that is used to generate the primary key value.

Style

Specifies CSS style attributes that are applied to the column when displayed in the grid.

Run Sample

UpdateReadOnly

Specifies that the column cannot be edited when a record is being amended.

UploadExtFilter

Specifies a comma separated inclusive list of valid file extensions that can be selected for uploading.

Run Sample

UploadMaxFileSize

Specifies the maximum size in KB of a file that can be uploaded.

 
UploadOverwrite

Indicates if an existing file can be overwritten when uploading a new file.

 
UploadRename

Indicates if a file can be re-named as a part of the file upload process.

UploadRootFolder

If a column is storing the path to an uploaded file then the UploadRootFolder must be specified to indicate where on the server the uploaded files should be saved.

Run Sample

UploadSubFolder

If part of the path to an uploaded file should be stored in the column value then that portion of the path must be specified in the UploadSubFolder property

Run Sample

 
Width

Specifies the width of a column