Links

DataGridView

Wisej.Web.DataGridView
Namespace: Wisej.Web
Assembly: Wisej.Framework (3.1.0.0)
Represents a data grid control.
C#
VB.NET
public class DataGridView : Control, ISupportInitialize, IWisejDataStore, IWisejHandler, IReadOnly
Public Class DataGridView
Inherits Control
Implements ISupportInitialize, IWisejDataStore, IWisejHandler, IReadOnly

Constructors

DataGridView()

Initializes a new instance of the DataGridView class.

Properties

AllowSortingDataSource

Boolean: Returns or sets whether the DataGridView can automatically sort rows in the DataSource when the data is in an IList object. (Default: True)
When the DataGridView is data-bound, sorting is delegated to the DataSource when it supports sorting (see SupportsSorting). Otherwise, if the data is in an IList object and AllowSortingDataSource is true, Wisej swaps the rows in the data source. This behavior is different than WinForms, where sorting of the data source is always delegated to the data source and is otherwise ignored. Setting AllowSortingDataSource to false reverts to the same behavior as in WinForms.

AllowUserToAddRows

Boolean: Returns or sets whether the user can add new rows. (Default: False)

AllowUserToDeleteRows

Boolean: Returns or sets whether the user is allowed to delete rows from the DataGridView. (Default: False)

AllowUserToOrderColumns

Boolean: Returns or sets whether manual column repositioning is enabled. (Default: False)

AllowUserToResizeColumns

Boolean: Returns or sets whether users can resize columns. (Default: True)

AllowUserToResizeRows

Boolean: Returns or sets whether users can resize rows. (Default: True)

AutoGenerateColumns

Boolean: Returns or sets whether columns are created automatically when the DataSource or DataMember properties are set. This property is ignored in design mode - auto column generation is always on. (Default: True)

AutoSize

Boolean: Returns or sets a value that indicates whether the control resizes based on its contents. (Default: False)

AutoSizeColumnsMode

DataGridViewAutoSizeColumnsMode: Returns or sets a value indicating how column widths are determined. (Default: None)

AutoSizeRowsMode

DataGridViewAutoSizeRowsMode: Returns or sets a value indicating how row heights are determined. (Default: None)
Throws:

BlockSize

Int32: Number of rows stored in a cache block. Determines the number of rows requested by the client when scrolling the grid.
It's better not to touch this value unless you know what you are doing.

BorderStyle

BorderStyle: Returns or sets the border style for the DataGridView. (Default: Solid)

CellBorderStyle

DataGridViewCellBorderStyle: Returns or sets the cell border style for the DataGridView control. (Default: Both)

ClipboardCopyMode

DataGridViewClipboardCopyMode: Returns or sets a value that indicates whether users can copy cell text values to the Clipboard and whether row and column header text is included. (Default: EnableWithAutoHeaderText)

ColumnCount

Int32: Returns or sets the number of columns displayed in the DataGridView. (Default: 0)
Throws:

ColumnHeadersBorderStyle

DataGridViewCellBorderStyle: Returns or sets the border style for the column headers in the DataGridView control. (Default: Both)

ColumnHeadersDefaultCellStyle

DataGridViewCellStyle: Returns or sets the default column header style.

ColumnHeadersHeight

Int32: Returns or sets the height, in pixels, of the column headers row.
Throws:
  • ArgumentOutOfRangeException The specified value when setting this property is less than the minimum height of 4 pixels or is greater than the maximum height of 32768 pixels.

ColumnHeadersHeightSizeMode

DataGridViewColumnHeadersHeightSizeMode: Returns or sets whether the height of the column headers is adjustable and whether it can be adjusted by the user or is automatically adjusted to fit the contents of the headers. [Since 3.0.13] (Default: DisableResizing)

ColumnHeadersVisible

Boolean: Returns or sets whether the column header row is displayed. (Default: True)
Throws:

Columns

DataGridViewColumnCollection: Returns a collection that contains all the columns in the control.

CurrentCell

DataGridViewCell: Returns or sets the currently active cell.
Throws:
  • InvalidOperationException The value of this property cannot be set because changes to the current cell cannot be committed or canceled. Or the specified cell when setting this property is in a hidden row or column. Re-entrant calling is only allowed when the DataGridView is bound to a DataSource. Re-entrant calling results from a change to the underlying data.
  • ArgumentException The specified cell when setting this property is not in the DataGridView.

CurrentCellAddress

Point: Returns the row and column indexes of the currently active cell.

CurrentRow

DataGridViewRow: Returns the row containing the current cell.

DataMember

String: Returns or sets the name of the list or table in the data source for which the DataGridView is displaying data. (Default: "")
Throws:

DataSource

Object: Returns or sets the data source that the DataGridView is displaying data for. (Default: null)
Throws:

DefaultCellStyle

DataGridViewCellStyle: Returns or sets the default cell style to be applied to the cells in the DataGridView if no other cell style properties are set.

DefaultRowHeight

Int32: Returns or sets the default row height.

DefaultSortMode

DataGridViewColumnsSortMode: Returns or sets the default SortMode for all columns when the property SortMode is set to NotSet (default). (Default: Automatic)

EditingControl

Control: Returns the control hosted by the current cell, if a cell with an editing control is in edit mode.

EditMode

DataGridViewEditMode: Returns or sets a value indicating how to begin editing a cell. (Default: EditOnKeystrokeOrF2)
Throws:
  • Exception The specified value when setting this property would cause the control to enter edit mode, but initialization of the editing cell value failed and either there is no handler for the DataError event or the handler has set the ThrowException property to true. The exception object can typically be cast to type FormatException.

FirstDisplayedCell

DataGridViewCell: Returns the first cell currently displayed in the DataGridView in the upper left corner.

FirstDisplayedColumnIndex

Int32: Returns the index of the column that is the first non-frozen column displayed on the DataGridView.
Throws:
  • ArgumentOutOfRangeException The specified value when setting this property is less than 0 or greater than the number of columns in the control minus 1.
  • InvalidOperationException The specified value when setting this property indicates a column with a Visible property value of false. Or the specified value when setting this property indicates a column with a Frozen property value of true.

FirstDisplayedRowIndex

Int32: Returns the index of the row that is the first row displayed on the DataGridView.
Throws:
  • ArgumentOutOfRangeException The specified value when setting this property is less than 0 or greater than the number of rows in the control minus 1.
  • InvalidOperationException The specified value when setting this property indicates a row with a Visible property value of false. Or the specified value when setting this property indicates a column with a Frozen property value of true.

HorizontalScrollingOffset

Int32: Returns the number of pixels by which the control is scrolled horizontally.

Indent

Int32: Returns or sets the distance in pixels to indent each child row node level. (Default: -1)
Throws:

IsCurrentCellDirty

Boolean: Returns a value indicating whether the current cell has uncommitted changes.

IsCurrentCellInEditMode

Boolean: Returns a value indicating whether the currently active cell is being edited.

IsCurrentRowDirty

Boolean: Returns a value indicating whether the current row has uncommitted changes.

Item(columnIndex, rowIndex)

DataGridViewCell: Returns or set the cell located in the specified column and at the specified row.
Throws:
  • ArgumentOutOfRangeException columnIndex is less than 0 or greater than the number of columns in the control minus 1; or rowIndex is less than 0 or greater than the number of rows in the control minus 1.

Item(columnName, rowIndex)

DataGridViewCell: Returns or set the cell located in the specified column and at the specified row.

Item(column, rowIndex)

DataGridViewCell: Returns or set the cell located in the specified column and at the specified row.

Item(cellAddress)

DataGridViewCell: Returns or set the cell located in the specified location.

KeepSameRowHeight

Boolean: Returns or sets whether the rows are always of the same height. (Default: False)

LiveResize

Boolean: Returns or sets whether the column and row resizing should be live: updated as the user resizes the row or the column. (Default: False)

MaxCachedBlocks

Int32: Maximum number of blocks kept in the client cache.
It's better not to touch this value unless you know what you are doing.

MultiSelect

Boolean: Returns or sets whether the user is allowed to select more than one cell, row, or column of the DataGridView at a time. (Default: True)

NewRowIndex

Int32: Returns the index of the row for new records.

NoDataMessage

String: Returns or sets an HTML string that is displayed when the DataGridView doesn't contain any row. (Default: "")

ReadOnly

Boolean: Returns or sets whether the user can edit the cells of the DataGridView control. (Default: False)
Throws:
  • InvalidOperationException The specified value when setting this property is true, the current cell is in edit mode, and the current cell contains changes that cannot be committed.
  • Exception The specified value when setting this property would cause the control to enter edit mode, but initialization of the editing cell value failed and either there is no handler for the DataError event or the handler has set the ThrowException property to true. The exception object can typically be cast to type FormatException.

RightClickSelection

Boolean: Returns or sets whether the row under the pointer gets selected on a right click. (Default: False)
When the right click lands outside of a selected area the selection is not changed regardless of the value of RightClickSelection.

RowCount

Int32: Returns or sets the number of rows displayed in the DataGridView. (Default: 0)
Throws:

RowHeaderColumn

DataGridViewColumn: Returns the DataGridViewColumn for the row headers.
Use this DataGridViewColumn to set the style and other properties for all the row headers.

RowHeadersDefaultCellStyle

DataGridViewCellStyle: Returns or sets the default style applied to the row header cells.

RowHeadersMinimumWidth

Int32: Returns or sets the minimum width, in pixels, of the column that contains the row headers.
Throws:
  • ArgumentOutOfRangeException The value is less than the minimum width of 2 pixels or is greater than the maximum width of 2000 pixels.

RowHeadersVisible

Boolean: Returns or sets whether the column that contains row headers is displayed. (Default: True)

RowHeadersWidth

Int32: Returns or sets the width, in pixels, of the column that contains the row headers.
Throws:
  • ArgumentOutOfRangeException The value is less than the minimum width of 2 pixels or is greater than the maximum width of 2000 pixels.

RowHeadersWidthSizeMode

DataGridViewRowHeadersWidthSizeMode: Returns or sets whether the width of the row headers is adjustable and whether it can be adjusted by the user or is automatically adjusted to fit the contents of the headers. (Default: EnableResizing)

Rows

DataGridViewRowCollection: Returns a collection that contains all the rows in the DataGridView control.

RowTemplate

DataGridViewRow: Returns or sets the row that represents the template for all the rows in the control.
Throws:

ScrollBars

ScrollBars: Returns or sets the type of scroll bars to display for the DataGridView control. (Default: Both)

SelectedCells

DataGridViewSelectedCellCollection: Returns the collection of selected cells.

SelectedColumns

DataGridViewSelectedColumnCollection: Returns the collection of selected columns.

SelectedRows

DataGridViewSelectedRowCollection: Returns the collection of selected rows.

SelectionDelay

Int32: Milliseconds to wait before sending selection events to the server. (Default: 150)
Use this property to avoid flooding the server with selection change events when users quickly select rows in a data-bound DataGridView that triggers other data-bounds controls to get updated. Throws:

SelectionMode

DataGridViewSelectionMode: Returns or sets a value indicating how the cells of the DataGridView can be selected. (Default: FullRowSelect)

ShowCellErrors

Boolean: Returns or sets whether cells will display an error glyphs for each cell that contains a data entry error. (Default: True)

ShowCellToolTips

Boolean: Returns or sets whether or not ToolTips will show when the mouse pointer pauses on a cell. (Default: True)

ShowColumnVisibilityMenu

Boolean: Returns or sets whether the column visibility menu button is visible. (Default: True)

ShowFocusCell

Boolean: Returns or sets a value indicating whether the DataGridView widget highlights the currently focused cell. (Default: True)

ShowRowErrors

Boolean: Returns or sets whether row headers will display an error glyphs for each row that contains a data entry error. (Default: True)

SortedColumn

DataGridViewColumn: Returns the column by which the DataGridView contents are currently sorted.

SortFrozenRows

Boolean: Returns or sets whether frozen rows should be sorted when sorting a column. (Default: True)

SortOrder

SortOrder: Returns a value indicating whether the items in the DataGridView control are sorted in ascending or descending order, or are not sorted.

SortSelectionMode

DataGridViewSortSelectionMode: Returns or sets a value indicating how the DataGridView updates the selection of rows and cells when it's sorted. (Default: UpdatePosition)
The selection is always cleared when sorting a data-bound DataGridView or when the grid contains hierarchical rows.

StandardTab

Boolean: Returns or sets whether the TAB key moves the focus to the next control in the tab order rather than moving focus to the next cell. (Default: False)

Tools

ComponentToolCollection: Returns the instance of ComponentToolCollection associated with this control.

ToolsPosition

Position: Returns or sets the position of the ComponentTool items associated with this control. (Default: Top)

TopLeftHeaderCell

DataGridViewColumnHeaderCell: Returns or sets the header cell located in the upper left corner of the DataGridView control.

TreeColumn

DataGridViewColumn: Returns or sets the column that displays the node open/close tree icons.
By default the DataGridView shows the open/close tree icons on the first visible and non-frozen column.

VirtualMode

Boolean: Returns or sets whether you have provided your own data-management operations for the DataGridView control. (Default: False)

VisibleRowCount

Int32: Returns the total number of visible rows currently displayed.

Methods

AddSummaryRows(summaryType, groupCol, summaryCol, style, customSummary)

Creates or updates a DataGridViewSummaryRow for each group limited by the values in column groupCol .
Parameter
Type
Description
summaryType
Determines the aggregation type.
groupCol
String
Name of the column that determines the group break values.
summaryCol
String
name of the column to aggregate.
style
Optional DataGridViewCellStyle for the summary rows.
customSummary
Optional custom summary function, used when summaryType is Custom.
Returns: DataGridViewSummaryRow[]. Array of the DataGridViewSummaryRow rows displaying the aggregated values.

AddSummaryRows(summaryType, summaryPosition, groupCol, summaryCol, style, customSummary)

Creates or updates a DataGridViewSummaryRow for each group limited by the values in column groupCol .
Parameter
Type
Description
summaryType
Determines the aggregation type.
summaryPosition
Indicates the position of the DataGridViewSummaryRow.
groupCol
String
Name of the column that determines the group break values.
summaryCol
String
Name of the column to aggregate.
style
Optional DataGridViewCellStyle for the summary rows.
customSummary
Optional custom summary function, used when summaryType is Custom.
Returns: DataGridViewSummaryRow[]. Array of the DataGridViewSummaryRow rows displaying the aggregated values.

AddSummaryRows(summaryType, groupFromCol, groupToCol, summaryCol, style, customSummary)

Creates or updates a DataGridViewSummaryRow for each group limited by the values in the columns from groupFromCol to groupToCol .
Parameter
Type
Description
summaryType
Determines the aggregation type.
groupFromCol
String
Name of the first column that determines the group break values.
groupToCol
String
Name of the last column that determines the group break values.
summaryCol
String
Name of the column to aggregate.
style
Optional DataGridViewCellStyle for the summary rows.
customSummary
Optional custom summary function, used when summaryType is Custom.
Returns: DataGridViewSummaryRow[]. Array of the DataGridViewSummaryRow rows displaying the aggregated values.

AddSummaryRows(summaryType, summaryPosition, groupFromCol, groupToCol, summaryCol, style, customSummary)

Creates or updates a DataGridViewSummaryRow for each group limited by the values in the columns from groupFromCol to groupToCol .
Parameter
Type
Description
summaryType
Determines the aggregation type.
summaryPosition
Indicates the position of the DataGridViewSummaryRow.
groupFromCol
String
Name of the first column that determines the group break values.
groupToCol
String
Name of the last column that determines the group break values.
summaryCol
String
Name of the column to aggregate.
style
Optional DataGridViewCellStyle for the summary rows.
customSummary
Optional custom summary function, used when summaryType is Custom.
Returns: DataGridViewSummaryRow[]. Array of the DataGridViewSummaryRow rows displaying the aggregated values.

AddSummaryRows(summaryType, groupCol, summaryCol, style, customSummary)

Creates or updates a DataGridViewSummaryRow for each group limited by the values in columns groupCol .
Parameter
Type
Description
summaryType
Determines the aggregation type.
groupCol
Column that determines the group break values.
summaryCol
Column to aggregate.
style
Optional DataGridViewCellStyle for the summary rows.
customSummary