DataGridView

Wisej.Web.DataGridView

Namespace: Wisej.Web

Assembly: Wisej.Framework (3.5.0.0)

Represents a data grid control.

public class DataGridView : Control, ISupportInitialize, IWisejDataStore, IWisejHandler, IReadOnly

Constructors

Initializes a new instance of the DataGridView class.

Initializes a new instance of the DataGridView class with a specified data source and an event handler for the CellClick event.

NameTypeDescription

dataSource

The data source to be displayed in the DataGridView.

onCellClick

An Action delegate to handle the CellClick event. Can be null.

Initializes a new instance of the DataGridView class with a specified location and size.

NameTypeDescription

location

The location of the DataGridView on its parent control.

size

The size of the DataGridView.

Properties

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.

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

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

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

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

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

Boolean: Returns or sets whether columns are created automatically when the DataSource or DataMember properties are set. (Default: True)

You can change the default value across the application using the AutoGenerateColumnsDefault property or related AppContext switch.

Boolean: EXPERIMENTAL: Default value for the AutoGenerateColumns property. Since 3.5.6 (Default: True)

The default is true. You can set the value by code or using AppContext switches: AppContext.SetSwitch("DataGridViewAutoGenerateColumns", false);

Boolean: EXPERIMENTAL: Returns or sets whether the first row or cell, depending on SelectionMode, is automatically selected when the grid is populated. Since 3.5.6 (Default: True)

You can change the default value across the application using the AutoSelectFirstRowDefault property or related AppContext switch.

Boolean: EXPERIMENTAL: Default value for the AutoSelectFirstRow property. Since 3.5.6 (Default: True)

The default is true. You can set the value by code or using AppContext switches: AppContext.SetSwitch("DataGridViewAutoSelectFirstRow", false);

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

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

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

Throws:

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: Returns or sets the border style for the DataGridView. (Default: Solid)

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

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)

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

Throws:

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

DataGridViewCellStyle: Returns or sets the default column header style.

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.

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)

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

Throws:

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

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.

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

DataGridViewRow: Returns the row containing the current cell.

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

Throws:

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

Throws:

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.

Int32: Returns or sets the default row height.

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

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

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.

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

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.

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.

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

Boolean: Returns whether the horizontal scroll bar is visible.

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

Throws:

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

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

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

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.

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

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

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

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

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)

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.

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)

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

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

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.

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.

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

Throws:

DataGridViewColumn: Returns the DataGridViewColumn for the row headers.

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

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

Int32: Returns or sets the minimum width, in pixels, of the column that contains the row headers.

Throws:

Int32: Returns or sets the minimum width, in pixels, of the column that contains the row headers.

Throws:

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

Int32: Returns or sets the width, in pixels, of the column that contains the row headers.

Throws:

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)

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

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

Throws:

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

DataGridViewSelectedCellCollection: Returns the collection of selected cells.

DataGridViewSelectedColumnCollection: Returns the collection of selected columns.

DataGridViewSelectedRowCollection: Returns the collection of selected rows.

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:

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

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

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

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

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

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

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

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

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

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.

Boolean: EXPERIMENTAL: Returns or sets whether the RETURN (Enter) key moves the focus to the cell below the current cell, rather than entering edit mode. (Default: False)

WinForms standard behavior corresponds to StandardReturn set to true.

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)

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

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

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

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.

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

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

Boolean: Returns whether the vertical scroll bar is visible.

Methods

Creates or updates a DataGridViewSummaryRow for each group limited by the values in column groupCol .

ParameterTypeDescription

summaryType

Determines the aggregation type.

groupCol

Name of the column that determines the group break values.

summaryCol

name of the column to aggregate.

Optional DataGridViewCellStyle for the summary rows.

Optional custom summary function, used when summaryType is Custom.

Returns: DataGridViewSummaryRow[]. Array of the DataGridViewSummaryRow rows displaying the aggregated values.

Creates or updates a DataGridViewSummaryRow for each group limited by the values in column groupCol .

ParameterTypeDescription

summaryType

Determines the aggregation type.

summaryPosition

Indicates the position of the DataGridViewSummaryRow.

groupCol

Name of the column that determines the group break values.

summaryCol

Name of the column to aggregate.

Optional DataGridViewCellStyle for the summary rows.

Optional custom summary function, used when summaryType is Custom.

Returns: DataGridViewSummaryRow[]. Array of the DataGridViewSummaryRow rows displaying the aggregated values.

Creates or updates a DataGridViewSummaryRow for each group limited by the values in the columns from groupFromCol to groupToCol .

ParameterTypeDescription

summaryType

Determines the aggregation type.

groupFromCol

Name of the first column that determines the group break values.

groupToCol

Name of the last column that determines the group break values.

summaryCol

Name of the column to aggregate.

Optional DataGridViewCellStyle for the summary rows.

Optional custom summary function, used when summaryType is Custom.

Returns: DataGridViewSummaryRow[]. Array of the DataGridViewSummaryRow rows displaying the aggregated values.

Creates or updates a DataGridViewSummaryRow for each group limited by the values in the columns from groupFromCol to groupToCol .

ParameterTypeDescription

summaryType

Determines the aggregation type.

summaryPosition

Indicates the position of the DataGridViewSummaryRow.

groupFromCol

Name of the first column that determines the group break values.

groupToCol

Name of the last column that determines the group break values.

summaryCol

Name of the column to aggregate.

Optional DataGridViewCellStyle for the summary rows.

Optional custom summary function, used when summaryType is Custom.

Returns: DataGridViewSummaryRow[]. Array of the DataGridViewSummaryRow rows displaying the aggregated values.

Creates or updates a DataGridViewSummaryRow for each group limited by the values in columns groupCol .

ParameterTypeDescription

summaryType

Determines the aggregation type.

groupCol

Column that determines the group break values.

summaryCol

Column to aggregate.

Optional DataGridViewCellStyle for the summary rows.

Optional custom summary function, used when summaryType is Custom.

Returns: DataGridViewSummaryRow[]. Array of the DataGridViewSummaryRow rows displaying the aggregated values.

Creates or updates a DataGridViewSummaryRow for each group limited by the values in columns groupCol .

ParameterTypeDescription

summaryType

Determines the aggregation type.

summaryPosition

Indicates the position of the DataGridViewSummaryRow.

groupCol

Column that determines the group break values.

summaryCol

Column to aggregate.

Optional DataGridViewCellStyle for the summary rows.

Optional custom summary function, used when summaryType is Custom.

Returns: DataGridViewSummaryRow[]. Array of the DataGridViewSummaryRow rows displaying the aggregated values.

Creates or updates a DataGridViewSummaryRow for each group limited by the values in the columns from groupFromCol to groupToCol .

ParameterTypeDescription

summaryType

Determines the aggregation type.

groupFromCol

First column that determines the group break values.

groupToCol

Last column that determines the group break values.

summaryCol

Column to aggregate.

Optional DataGridViewCellStyle for the summary rows.

Optional custom summary function, used when summaryType is Custom.

Returns: DataGridViewSummaryRow[]. Array of the DataGridViewSummaryRow rows displaying the aggregated values.

Creates or updates a DataGridViewSummaryRow for each group limited by the values in the columns from groupFromCol to groupToCol .

ParameterTypeDescription

summaryType

Determines the aggregation type.

summaryPosition

Indicates the position of the DataGridViewSummaryRow.

groupFromCol

First column that determines the group break values.

groupToCol

Last column that determines the group break values.

summaryCol

Column to aggregate.

Optional DataGridViewCellStyle for the summary rows.

Optional custom summary function, used when summaryType is Custom.

Returns: DataGridViewSummaryRow[]. Array of the DataGridViewSummaryRow rows displaying the aggregated values.

Populates the DataGridView from the data appending the rows to the existing rows.

ParameterTypeDescription

data

The object that contains data for the DataGridView to display.

The name of the table or list in the data object for which the DataGridView should load the data.

Returns: Int32. Numbers of rows appended.

Use this method to fill a DataGridView without binding it to the data source.

Returns whether all the cells are currently selected.

ParameterTypeDescription

includeInvisibleCells

true to include the rows and columns with the Visible property set to false.

Returns: Boolean. true if all cells (or all visible cells) are selected or if there are no cells (or no visible cells); otherwise, returns false.

Adjusts the width of the column to fit the contents of its cells including the header cell.

ParameterTypeDescription

columnIndex

The index of the column to resize; -1 indicates all columns.

Throws:

Adjusts the width of the column to fit the contents of its cells including the header cell.

ParameterTypeDescription

columnIndex

The index of the column to resize; -1 indicates all columns.

extraSpace

Additional space in pixels.

Throws:

Adjusts the width of the specified column using the specified size mode.

ParameterTypeDescription

columnIndex

The index of the column to resize; -1 indicates all columns.

autoSizeMode

Throws:

Adjusts the width of the specified column using the specified size mode.

ParameterTypeDescription

columnIndex

The index of the column to resize; -1 indicates all columns.

autoSizeMode

extraSpace

Additional space in pixels.

Throws:

Adjusts the height of the column headers to fit the contents of the largest header.

Adjusts the height of the column headers based on the contents of the header in the specified column.

ParameterTypeDescription

columnIndex

The index of the column to resize; -1 indicates all columns.

Throws:

Adjusts the width of all columns to fit the contents of their cells including the header cells.

Adjusts the width of all columns to fit the contents of their cells including the header cells.

ParameterTypeDescription

extraSpace

Additional space in pixels.

Adjusts the width of all columns using the specified size mode.

ParameterTypeDescription

autoSizeMode

Throws:

Adjusts the width of all columns using the specified size mode.

ParameterTypeDescription

autoSizeMode

extraSpace

Additional space in pixels.

Throws:

Adjusts the height of the row to fit the contents of all its cells including the header cell.

ParameterTypeDescription

rowIndex

The index of the row to resize.

Throws:

Adjusts the height of the row to fit the contents of all its cells including the header cell.

ParameterTypeDescription

rowIndex

The index of the row to resize.

extraSpace

Additional space in pixels.

Throws:

Adjusts the height of the row using the specified size mode.

ParameterTypeDescription

rowIndex

The index of the row to resize.

autoSizeMode

One of the DataGridViewAutoSizeRowMode values.

Throws:

Adjusts the height of the row using the specified size mode.

ParameterTypeDescription

rowIndex

The index of the row to resize.

autoSizeMode

One of the DataGridViewAutoSizeRowMode values.

extraSpace

Additional space in pixels.

Throws:

Adjusts the width of the row headers using the specified size mode.

ParameterTypeDescription

autoSizeMode

Throws:

Adjusts the width of the row headers using the specified size mode.

ParameterTypeDescription

autoSizeMode

extraSpace

Additional space in pixels.

Throws:

Adjusts the width of the row headers based on the contents of the header in the specified row and using the specified size mode.

ParameterTypeDescription

rowIndex

The index of the row header with the changed content.

autoSizeMode

Throws:

Adjusts the width of the row headers based on the contents of the header in the specified row and using the specified size mode.

ParameterTypeDescription

rowIndex

The index of the row header with the changed content.

autoSizeMode

extraSpace

Additional space in pixels.

Throws:

Adjusts the heights of all rows in the client's data cache to fit the contents of all their cells, including the header cells.

Adjusts the heights of all rows in the client's data cache to fit the contents of all their cells, including the header cells.

ParameterTypeDescription

extraSpace

Additional space in pixels.

Adjusts the heights of the rows using the specified size mode.

ParameterTypeDescription

autoSizeMode

One of the DataGridViewAutoSizeRowMode values.

Throws:

Puts the current cell in edit mode.

ParameterTypeDescription

true to select all the cell's contents; false to not select any contents.

Returns: Boolean. true if the current cell is already in edit mode or successfully enters edit mode; otherwise, false.

Throws:

Prevents the control from updating until the EndUpdate method is called.

Cancels edit mode for the currently selected cell and discards any changes.

Returns: Boolean. true if the cancel was successful; otherwise, false.

Returns whether the specified column can be sorted automatically.

ParameterTypeDescription

sortColumn

Column being sorted.

Returns: Boolean. true if the DataGridView should sort the data.

Clears the current selection.

Commits changes to cell without ending edit mode.

Returns: Boolean. true if the changes were committed; otherwise false.

Throws:

  • Exception The cell value could not be committed and either there is no handler for the DataError event or the handler has set the ThrowException property to true.

Invoked by all the AddSummaryRows methods to create a new DataGridViewSummaryRow in relation to the specified group .

ParameterTypeDescription

group

An array of the DataGridViewRow summarized by the group row being created.

summaryPosition

The SummaryRowPosition indicated by the AddSummaryRows method call.

groupFromCol

The first DataGridViewColumn delimiting the group.

groupToCol

The last DataGridViewColumn delimiting the group.

style

A DataGridViewCellStyle for the summary row; can be null.

Returns: DataGridViewSummaryRow.

Override this method to create a custom derived class from DataGridViewSummaryRow.

Commits and ends the edit operation on the current cell.

Returns: Boolean. true if the edit operation is committed and ended; otherwise, false.

Throws:

  • Exception The cell value could not be committed and either there is no handler for the DataError event or the handler has set the ThrowException property to true.

Resumes updating of the control after it was suspended by the BeginUpdate method.

Populates the DataGridView from the data .

ParameterTypeDescription

data

The object that contains data for the DataGridView to display.

The name of the table or list in the data object for which the DataGridView should load the data.

Returns: Int32. Numbers of rows added.

Use this method to fill a DataGridView without binding it to the data source.

Returns the formatted values that represent the contents of the selected cells for copying to the Clipboard.

Returns: DataObject. A DataObject with the contents of the selected cells.

Throws:

Retrieves the command for the specified cell without retrieving a DataGridViewRow and without causing the permanent creation of a row instance. This method is particularly useful when the grid shows a large data set and/or it's operating in VirtualMode.

ParameterTypeDescription

columnIndex

The index of the column containing the cell.

rowIndex

The index of the row containing the cell.

Returns: ICommand. The object value stored in the cell.

Throws:

Retrieves the command for the specified cell without retrieving a DataGridViewRow and without causing the permanent creation of a row instance. This method is particularly useful when the grid shows a large data set and/or it's operating in VirtualMode.

ParameterTypeDescription

cellAddress

Row and column index of the cell.

Returns: ICommand. The object value stored in the cell.

Throws:

Retrieves the command for the specified cell without retrieving a DataGridViewRow and without causing the permanent creation of a row instance. This method is particularly useful when the grid shows a large data set and/or it's operating in VirtualMode.

ParameterTypeDescription

column

The DataGridViewColumn that contains the cell.

rowIndex

The index of the row containing the cell.

Returns: ICommand. The object value stored in the cell.

Throws:

Retrieves the command for the specified cell without retrieving a DataGridViewRow and without causing the permanent creation of a row instance. This method is particularly useful when the grid shows a large data set and/or it's operating in VirtualMode.

ParameterTypeDescription

columnName

The Name of the column containing the cell.

rowIndex

The index of the row containing the cell.

Returns: ICommand. The object value stored in the cell.

Throws:

Retrieves the value for the specified cell, as formatted for display, without retrieving a DataGridViewRow and without causing the permanent creation of a row instance. This method is particularly useful when the grid shows a large data set and/or it's operating in VirtualMode.

ParameterTypeDescription

columnIndex

The index of the column containing the cell.

rowIndex

The index of the row containing the cell.

Returns: Object. The formatted value stored in the cell.

Throws:

Retrieves the value for the specified cell, as formatted for display, without retrieving a DataGridViewRow and without causing the permanent creation of a row instance. This method is particularly useful when the grid shows a large data set and/or it's operating in VirtualMode.

ParameterTypeDescription

column

The DataGridViewColumn that contains the cell.

rowIndex

The index of the row containing the cell.

Returns: Object. The formatted value stored in the cell.

Throws:

Retrieves the value for the specified cell, as formatted for display, without retrieving a DataGridViewRow and without causing the permanent creation of a row instance. This method is particularly useful when the grid shows a large data set and/or it's operating in VirtualMode.

ParameterTypeDescription

columnName

The Name of the column containing the cell.

rowIndex

The index of the row containing the cell.

Returns: Object. The formatted value stored in the cell.

Throws:

Returns the state of the DataGridViewRow at the specified index.

ParameterTypeDescription

rowIndex

The index of the row.

Returns: DataGridViewElementStates. A combination of DataGridViewElementStates values indicating the state of the row.

Throws:

Retrieves the value for the specified cell without retrieving a DataGridViewRow and without causing the permanent creation of a row instance. This method is particularly useful when the grid shows a large data set and/or it's operating in VirtualMode.

ParameterTypeDescription

columnIndex

The index of the column containing the cell.

rowIndex

The index of the row containing the cell.

Returns: Object. The object value stored in the cell.

Throws:

Retrieves the value for the specified cell without retrieving a DataGridViewRow and without causing the permanent creation of a row instance. This method is particularly useful when the grid shows a large data set and/or it's operating in VirtualMode.

ParameterTypeDescription

cellAddress

Row and column index of the cell.

Returns: Object. The object value stored in the cell.

Throws:

Retrieves the value for the specified cell without retrieving a DataGridViewRow and without causing the permanent creation of a row instance. This method is particularly useful when the grid shows a large data set and/or it's operating in VirtualMode.

ParameterTypeDescription

column

The DataGridViewColumn that contains the cell.

rowIndex

The index of the row containing the cell.

Returns: Object. The object value stored in the cell.

Throws:

Retrieves the value for the specified cell without retrieving a DataGridViewRow and without causing the permanent creation of a row instance. This method is particularly useful when the grid shows a large data set and/or it's operating in VirtualMode.

ParameterTypeDescription

columnName

The Name of the column containing the cell.

rowIndex

The index of the row containing the cell.

Returns: Object. The object value stored in the cell.

Throws:

Returns the column index and row index that contain the specified x, y client coordinates.

ParameterTypeDescription

x

The x coordinate relative to the DataGridView control.

y

The y coordinate relative to the DataGridView control.

Returns: HitTestInfo. A HitTestInfo that contains the column index and row index information.

Returns the column index and row index that contain the specified x, y client coordinates.

ParameterTypeDescription

position

The x, y coordinate relative to the DataGridView control.

Returns: HitTestInfo. A HitTestInfo that contains the column index and row index information.

Checks if the specified cell can enter edit mode.

ParameterTypeDescription

cell

Cell to verify.

Returns: Boolean. true is the specified cell, the owner row, owner column and the data source, allow user editing.

Checks if the cell at the colIndex and rowIndex location can enter edit mode.

ParameterTypeDescription

colIndex

The column index of the cell to verify.

rowIndex

The row index of the cell to verify.

Returns: Boolean. true is the specified cell, the owner row, owner column and the data source, allow user editing.

Checks if the cell at the cellAddress location can enter edit mode.

ParameterTypeDescription

cellAddress

Coordinates of the cell to verify.

Returns: Boolean. true is the specified cell, the owner row, owner column and the data source, allow user editing.

Checks if the specified cell is visible.

ParameterTypeDescription

cell

Cell to verify.

Returns: Boolean. true is the specified cell, the owner row, owner column and the data source, allow user editing.

Checks if the cell at the colIndex and rowIndex location is visible.

ParameterTypeDescription

colIndex

The column index of the cell to verify.

rowIndex

The row index of the cell to verify.

Returns: Boolean. true is the specified cell, the owner row, owner column and the data source, allow user editing.

Checks if the cell at the cellAddress location is visible.

ParameterTypeDescription

cellAddress

Coordinates of the cell to verify.

Returns: Boolean. true is the specified cell, the owner row, owner column and the data source, allow user editing.

Verifies that the cell address refers to a valid cell.

ParameterTypeDescription

cellAddress

Cell address to verify.

Returns: Boolean. true if the coordinates correspond to a valid cell address.

Verifies that the column index and row index refer to a valid cell.

ParameterTypeDescription

colIndex

The index of the column to verify.

rowIndex

The index of the row to verify.

Returns: Boolean. true if the coordinates correspond to a valid cell address.

Verifies that the column index refer to a valid column.

ParameterTypeDescription

colIndex

The index of the column to verify.

Returns: Boolean. true if the column index corresponds to a valid column.

Verifies that the row index refer to a valid row.

ParameterTypeDescription

rowIndex

The index of the row to verify.

Returns: Boolean. true if the row index corresponds to a valid row.

Notifies the DataGridView that the current cell has uncommitted changes.

ParameterTypeDescription

dirty

True to indicate the cell has uncommitted changes; otherwise, false.

Fires the TopLeftHeaderClick event, if MultiSelect is true, selects all the rows in the control.

ParameterTypeDescription

e

A DataGridViewCellMouseEventArgs that contains the event data.

Throws:

Forces a full reload of the data displayed by this DataGridView.

Forces a full reload of the data displayed by this DataGridView.

ParameterTypeDescription

refreshChildren

True to also refresh all the children of this control.

Removes the summary rows that match the specified summaryPosition and grouped by groupFromCol and groupToCol .

ParameterTypeDescription

summaryPosition

Position of the summary rows to remove.

groupFromCol

First column that determines the group break values.

groupToCol

Last column that determines the group break values.

Removes the all the summary rows.

Removes the summary rows that match the specified summaryPosition .

ParameterTypeDescription

summaryPosition

Position of the summary rows to remove.

Removes the summary rows grouped by groupFromCol .

ParameterTypeDescription

groupFromCol

Name of the first column that determines the group break values.

Removes the summary rows grouped by groupFromCol and groupToCol .

ParameterTypeDescription

groupFromCol

Name of the first column that determines the group break values.

groupToCol

Name of the last column that determines the group break values.

Removes the summary rows grouped by groupFromCol .

ParameterTypeDescription

groupFromCol

First column that determines the group break values.

Removes the summary rows grouped by groupFromCol and groupToCol .

ParameterTypeDescription

groupFromCol

First column that determines the group break values.

groupToCol

Last column that determines the group break values.

Removes the summary rows that match the specified summaryPosition and grouped by groupFromCol .

ParameterTypeDescription

summaryPosition

Position of the summary rows to remove.

groupFromCol

Name of the first column that determines the group break values.

Removes the summary rows that match the specified summaryPosition and grouped by groupFromCol and groupToCol .

ParameterTypeDescription

summaryPosition

Position of the summary rows to remove.

groupFromCol

Name of the first column that determines the group break values.

groupToCol

Name of the last column that determines the group break values.

Scrolls the specified cell into view.

ParameterTypeDescription

cell

The DataGridViewCell to scroll into view.

Throws:

Scrolls the specified cell into view aligned according to the position specified by alignX and alignY , if possible.

ParameterTypeDescription

cell

The DataGridViewCell to scroll into view.

alignX

One of Left or Right. Any other value is ignored and will use the least-effort alignment.

alignY

One of Top or Bottom. Any other value is ignored and will use the least-effort alignment.

Throws:

Scrolls the specified cell into view.

ParameterTypeDescription

cellAddress

The address of the cell to scroll into view.

Throws:

  • ArgumentOutOfRangeException cellAddress .X is less than -1 or greater than the number of columns in the control, or cellAddress .Y is less than -1 or greater than the number of rows in the control.

Scrolls the specified cell into view aligned according to the position specified by alignX and alignY , if possible.

ParameterTypeDescription

cellAddress

The address of the cell to scroll into view.

alignX

One of Left or Right. Any other value is ignored and will use the least-effort alignment.

alignY

One of Top or Bottom. Any other value is ignored and will use the least-effort alignment.

Throws:

  • ArgumentOutOfRangeException cellAddress .X is less than -1 or greater than the number of columns in the control, or cellAddress .Y is less than -1 or greater than the number of rows in the control.

Scrolls the specified cell into view.

ParameterTypeDescription

columnIndex

The zero-based column index of the cell to scroll into view.

rowIndex

The zero-based row index of the cell to scroll into view.

Throws:

  • ArgumentOutOfRangeException columnIndex is less than -1 or greater than the number of columns in the control, or rowIndex is less than -1 or greater than the number of rows in the control.

Scrolls the specified cell into view aligned according to the position specified by alignX and alignY , if possible.

ParameterTypeDescription

columnIndex

The zero-based column index of the cell to scroll into view.

rowIndex

The zero-based row index of the cell to scroll into view.

alignX

One of Left or Right. Any other value is ignored and will use the least-effort alignment.

alignY

One of Top or Bottom. Any other value is ignored and will use the least-effort alignment.

Throws:

  • ArgumentOutOfRangeException columnIndex is less than -1 or greater than the number of columns in the control, or rowIndex is less than -1 or greater than the number of rows in the control.

Scrolls the specified column into view.

ParameterTypeDescription

columnIndex

The zero-based column index of the cell to scroll into view.

Throws:

Scrolls the specified column into view aligned to the left or right according to the position specified by alignX .

ParameterTypeDescription

columnIndex

The zero-based column index of the cell to scroll into view.

alignX

One of Left or Right. Any other value is ignored and will use the least-effort alignment.

Throws:

Scrolls the specified column into view.

ParameterTypeDescription

column

The DataGridViewColumnto scroll into view.

Throws:

Scrolls the specified column into view aligned to the left or right according to position specified by alignX .

ParameterTypeDescription

column

The DataGridViewColumnto scroll into view.

alignX

One of Left or Right. Any other value is ignored and will use the least-effort alignment.

Throws:

Scrolls the specified row into view.

ParameterTypeDescription

rowIndex

The zero-based row index of the cell to scroll into view.

Throws:

Scrolls the specified row into view aligned to the top or bottom according to the position specified by alignY .

ParameterTypeDescription

rowIndex

The zero-based row index of the cell to scroll into view.

alignY

One of Top or Bottom. Any other value is ignored and will use the least-effort alignment.

Throws:

Scrolls the specified row into view.

ParameterTypeDescription

row

The DataGridViewRowto scroll into view.

Throws:

Scrolls the specified row into view aligned to the top or bottom according to the position specified by alignY .

ParameterTypeDescription

row

The DataGridViewRowto scroll into view.

alignY

One of Top or Bottom. Any other value is ignored and will use the least-effort alignment.

Throws:

Selects all the cells, or rows, or columns, according to the SelectionMode property when the MultiSelect is true.

Selects all the cells, regardless of the SelectionMode and MultiSelect properties.

Selects all the columns, regardless of the SelectionMode and MultiSelect properties.

Selects all the rows, regardless of the SelectionMode and MultiSelect properties.

Sets the command of the specified cell without retrieving a DataGridViewRow and without causing the permanent creation of a row instance. This method is particularly useful when the grid shows a large data set and/or it's operating in VirtualMode.

ParameterTypeDescription

columnIndex

The index of the column containing the cell.

rowIndex

The index of the row containing the cell.

command

Value to store in the cell identified by columnIndex and rowIndex .

Throws:

Sets the command of the specified cell without retrieving a DataGridViewRow and without causing the permanent creation of a row instance. This method is particularly useful when the grid shows a large data set and/or it's operating in VirtualMode.

ParameterTypeDescription

cellAddress

Row and column index of the cell.

command

Value to store in the cell identified by cellAddress .

Throws:

Sets the command of the specified cell without retrieving a DataGridViewRow and without causing the permanent creation of a row instance. This method is particularly useful when the grid shows a large data set and/or it's operating in VirtualMode.

ParameterTypeDescription

columnName

The Name of the column containing the cell.

rowIndex

The index of the row containing the cell.

command

Value to store in the cell identified by columnName and rowIndex .

Throws:

Sets the command of the specified cell without retrieving a DataGridViewRow and without causing the permanent creation of a row instance. This method is particularly useful when the grid shows a large data set and/or it's operating in VirtualMode.

ParameterTypeDescription

column

The DataGridViewColumn that contains the cell.

rowIndex

The index of the row containing the cell.

command

Value to store in the cell identified by column and rowIndex .

Throws:

Sets the currently focused cell.

ParameterTypeDescription

cellAddress

Address of the cell.

Sets the currently focused cell.

ParameterTypeDescription

columnIndex

Column index of the cell.

rowIndex

Row index of the cell.

Sets the state for the row at rowIndex .

ParameterTypeDescription

rowIndex

The index of the row.

state

When using this method, the state parameter must contain all the states to set for the row. The best way to do this is to use GetRowState first and then OR or XOR or AND the state to alter. To set a specific state use SetRowState. Throws:

Sets the state for the row at rowIndex .

ParameterTypeDescription

rowIndex

The index of the row.

state

DataGridViewElementStates state to turn on or off.

on

True to add the state , otherwise false to remove the state .

Throws:

Sets the value of the specified cell without retrieving a DataGridViewRow and without causing the permanent creation of a row instance. This method is particularly useful when the grid shows a large data set and/or it's operating in VirtualMode.

ParameterTypeDescription

columnIndex

The index of the column containing the cell.

rowIndex

The index of the row containing the cell.

value

Value to store in the cell identified by columnIndex and rowIndex .

Throws:

Sets the value of the specified cell without retrieving a DataGridViewRow and without causing the permanent creation of a row instance. This method is particularly useful when the grid shows a large data set and/or it's operating in VirtualMode.

ParameterTypeDescription

cellAddress

Row and column index of the cell.

value

Value to store in the cell identified by cellAddress .

Throws:

Sets the value of the specified cell without retrieving a DataGridViewRow and without causing the permanent creation of a row instance. This method is particularly useful when the grid shows a large data set and/or it's operating in VirtualMode.

ParameterTypeDescription

columnName

The Name of the column containing the cell.

rowIndex

The index of the row containing the cell.

value

Value to store in the cell identified by columnName and rowIndex .

Throws:

Sets the value of the specified cell without retrieving a DataGridViewRow and without causing the permanent creation of a row instance. This method is particularly useful when the grid shows a large data set and/or it's operating in VirtualMode.

ParameterTypeDescription

column

The DataGridViewColumn that contains the cell.

rowIndex

The index of the row containing the cell.

value

Value to store in the cell identified by column and rowIndex .

Throws:

Sorts the contents of the DataGridView control in ascending or descending order based on the contents of the specified column.

ParameterTypeDescription

column

The column by which to sort the contents of the DataGridView.

direction

One of the ListSortDirection values.

Throws:

Sorts the contents of the DataGridView control using an implementation of the IComparer interface.

ParameterTypeDescription

comparer

An implementation of IComparer that performs the custom sorting operation.

Throws:

Causes the control to update the corresponding client side widget. When in design mode, causes the rendered control to update its entire surface in the designer.

Events

EventHandler Fired when the value of the AllowUserToAddRows property changes.

EventHandler Fired when the value of the AllowUserToDeleteRowsChanged property changes.

EventHandler Fired when the value of the AllowUserToOrderColumns property changes.

EventHandler Fired when the value of the AllowUserToResizeColumns property changes.

EventHandler Fired when the value of the AllowUserToResizeRows property changes.

DataGridViewCellCancelEventHandler Fired when edit mode starts for the selected cell.

DataGridViewCellEventHandler Fired when any part of a cell is clicked.

DataGridViewCellEventHandler Fired when the command of a cell changes.

DataGridViewCellCommandEventHandler Fired when the VirtualMode property of the DataGridView control is true and the DataGridView requires a command for a cell in order to execute a user action.

DataGridViewCellCommandEventHandler Fired when the VirtualMode property of the DataGridView control is true and a cell command has changed and requires storage in the underlying data source.

DataGridViewCellContextMenuNeededEventHandler Fired when a cell's context menu is needed.

DataGridViewCellEventHandler Fired when the user double-clicks anywhere in a cell.

DataGridViewCellEventHandler Fired when edit mode stops for the current cell.

DataGridViewCellEventHandler Fired when the current cell changes in the DataGridView control or when the control receives input focus.

DataGridViewCellEventHandler Fired when the value of the ErrorText property of a cell changes.

DataGridViewCellErrorTextNeededEventHandler Fired when a cell's error text is needed.

DataGridViewCellFormattingEventHandler Fired when the contents of a cell need to be formatted for display.

DataGridViewCellEventHandler Fired when a cell loses input focus and is no longer the current cell.

DataGridViewCellMouseEventHandler Occurs whenever the user clicks anywhere on a cell with the mouse.

DataGridViewCellMouseEventHandler Fired when a cell within the DataGridView is double-clicked.

DataGridViewCellMouseEventHandler Fired when the user presses a mouse button while the pointer is within the boundaries of a cell.

DataGridViewCellEventHandler Fired when the mouse pointer enters a cell.

This event fires only if there is an handler attached to it. A simple overload of the On[Event] method in a derived class will not be invoked unless there is at least one handler attached to the event.

DataGridViewCellEventHandler Fired when the mouse pointer leaves a cell.

This event fires only if there is an handler attached to it. A simple overload of the On[Event] method in a derived class will not be invoked unless there is at least one handler attached to the event.

DataGridViewCellMouseEventHandler Fired when the mouse pointer moves over the DataGridView control.

This event fires only if there is an handler attached to it. A simple overload of the On[Event] method in a derived class will not be invoked unless there is at least one handler attached to the event.

DataGridViewCellMouseEventHandler Fired when the user releases a mouse button while over a cell.

DataGridViewCellPaintEventHandler Fired when a cell with the property UserPaint set to true needs to be drawn.

DataGridViewCellParsingEventHandler Fired when a cell leaves edit mode if the cell value has been modified.

DataGridViewCellStateChangedEventHandler Fired when a cell state changes, such as when the cell is selected or focused.

DataGridViewCellEventHandler Fired when the Style property of a DataGridViewCell changes.

DataGridViewCellStyleContentChangedEventHandler Fired when one of the values of a cell style changes.

DataGridViewToolClickEventHandler Fired when a ComponentTool hosted in a cell editor is clicked.

DataGridViewCellEventHandler Fired when the value of the ToolTipText property of a cell changes.

DataGridViewCellToolTipTextNeededEventHandler Fired when a cell's ToolTip text is needed.

DataGridViewCellEventHandler Occurs after the cell has finished validating.

DataGridViewCellValidatingEventHandler Fired when a cell loses input focus, enabling content validation.

DataGridViewCellEventHandler Fired when the value of a cell changes.

DataGridViewCellValueEventHandler Fired when the VirtualMode property of the DataGridView control is true and the DataGridView requires a value for a cell in order to format and display the cell.

DataGridViewCellValueEventHandler Fired when the VirtualMode property of the DataGridView control is true and a cell value has changed and requires storage in the underlying data source.

DataGridViewColumnEventHandler Fired when a column is added to the control.

DataGridViewColumnEventHandler Fired when the value the DisplayIndex property for a column changes.

DataGridViewColumnEventHandler Fired when the FillWeight property changes.

DataGridViewCellMouseEventHandler Fired when the user clicks a column header.

DataGridViewCellMouseEventHandler Fired when a column header is double-clicked.

EventHandler Fired when the value of the ColumnHeadersHeight property changes.

DataGridViewColumnEventHandler Fired when the value of the MaximumWidth property for a column changes.

DataGridViewColumnEventHandler Fired when the value of the MinimumWidth property for a column changes.

DataGridViewColumnEventHandler Fired when the Name property changes.

DataGridViewColumnEventHandler Fired when a column is removed from the control.

DataGridViewColumnEventHandler Fired when the value of the SortMode property changes.

DataGridViewColumnStateChangedEventHandler Fired when a column changes state, such as becoming visible.

DataGridViewColumnEventHandler Fired when the value of the Width property for a column changes.

EventHandler Fired when the CurrentCell property changes.

DataGridViewBindingCompleteEventHandler Occurs after a data-binding operation has finished.

DataGridViewDataErrorEventHandler Fired when a data parsing or data validation operation throws an exception, or when committing data to a data source fails.

EventHandler Fired when value of the DataMember property changes.

DataGridViewDataReadEventHandler Occurs when the client requests a set of rows from the server.

You can use this event when the DataGridView is in VirtualMode to pre-populate a paged data set used when handling the CellValueNeeded events.

EventHandler Fired when the value of the DataSource property changes.

DataGridViewDataUpdatedEventHandler Fired when the client has updated one or more rows in the grid.

This event is fired only if the application has attached at least one handler to the event. Otherwise, simply overriding OnDataUpdated won't work.

EventHandler Fired when the value of the DefaultRowHeight property changes.

DataGridViewRowEventHandler Fired when the user enters the row for new records so that it can be populated with default values.

DataGridViewEditingControlShowingEventHandler Fired when a control for editing a cell is showing.

EventHandler Fired when the value of the EditMode property changes.

EventHandler Fired when the value of the KeepSameRowHeight property changes.

DataGridViewCellEventHandler Fired when the user tabs past the last cell.

EventHandler Fired when the value of the LiveResize property changes.

EventHandler Fired when the value of the MultiSelect property changes.

DataGridViewRowEventHandler Fired when the VirtualMode property of the DataGridView is true and the user navigates to the new row at the bottom of the DataGridView.

EventHandler Fired when the value of the ReadOnly property changes.

DataGridViewRowEventHandler Fired when a parent row is collapsed.

DataGridViewCellEventHandler Fired when a row receives input focus but before it becomes the current row.

DataGridViewRowEventHandler Fired when the ErrorText property of a row changes.

DataGridViewRowErrorTextNeededEventHandler Fired when the row's error text is required.

DataGridViewRowEventHandler Fired when a parent row is expanded.

DataGridViewCellMouseEventHandler Fired when the user clicks within the boundaries of a row header.

DataGridViewCellMouseEventHandler Fired when a row header is double-clicked.

EventHandler Fired when value of the RowHeadersWidth property changes.

DataGridViewRowEventHandler Fired when the value of the Height property for a row changes.

DataGridViewRowHeightInfoNeededEventHandler Fired when information about row height is requested.

DataGridViewCellEventHandler Fired when a row loses input focus and is no longer the current row.

DataGridViewRowEventHandler Fired when the value of the MaximumHeight property for a row changes.

DataGridViewRowEventHandler Fired when the value of the MinimumHeight property for a row changes.

DataGridViewRowsAddedEventHandler Occurs after a new row is added to the DataGridView.

DataGridViewRowsRemovedEventHandler Fired when a row or rows are deleted from the DataGridView.

DataGridViewRowStateChangedEventHandler Fired when a row changes state, such as getting selected.

DataGridViewCellEventHandler Occurs after a row has finished validating.

DataGridViewCellCancelEventHandler Fired when a row is validating.

ScrollEventHandler Fired when the user or code scrolls the grid.

This event fires only if there is an handler attached to it. A simple overload of the On[Event] method in a derived class will not be invoked unless there is at least one handler attached to the event.

EventHandler Fired when the current selection changes.

EventHandler Fired when the value of the ShowColumnVisibilityMenu property changes.

DataGridViewSortCompareEventHandler Fired when the DataGridView compares two cell values to perform a sort operation.

EventHandler Fired when the DataGridView control completes a sorting operation.

EventHandler Fired when the value of the StandardReturn property changes.

EventHandler Fired when the value of the StandardTab property changes.

ToolClickEventHandler Fired when a ComponentTool is clicked.

DataGridViewCellCancelEventHandler Fired when the user presses a mouse button while the pointer is on the top-left corner cell.

DataGridViewRowEventHandler Fired when the user has finished adding a row to the DataGridView control.

DataGridViewRowEventHandler Fired when the user has finished deleting a row from the DataGridView control.

DataGridViewRowCancelEventHandler Fired when the user deletes a row from the DataGridView control.

Implements

NameDescription

Bindable components implement this interface.

Controls that support drag & drop operations implement this interface.

Provides access to the ReadOnly property for coontrols that support the read-only mode.

All wisej components implement this interface.

All wisej controls derived from the Control class must implement this interface.

All wisej data stores implement this interface.

Represents a Wisej component that is capable of handling postback requests from the client.

Allows an object to serialize itself.

Last updated