Skip to main content
Version: 4.1

DataGridViewCell

Namespace: Wisej.Web

Assembly: Wisej.Framework (4.1.0.0)

Represents an individual cell in a DataGridView control.

public class DataGridViewCell : DataGridViewElement, ICloneable, ICommandSource, IUserData

Constructors

Instance member DataGridViewCell()

Initializes a new instance of DataGridViewCell.

Properties

Instance member CellRenderer

String: Returns the name of the cell renderer to use on the client side to render the cell. If it's null or empty, it defaults to "Cell".

The name of the cell renderer can be a fully qualified class name (i.e. "wisej.web.datagrid.cellRenderer.Cell") or just the class name (i.e. "ImageCell") in which case the client library prepends "wisej.web.datagrid.cellRenderer".

Instance member ColumnIndex

Int32: Returns the column index for this cell.

Instance member Command

ICommand: Returns or sets the ICommand implementation to invoke. (Default: null)

Instance member ContextMenu

ContextMenu: Returns or sets the shortcut menu associated with the cell. (Default: null)

Instance member Control

Control: Returns or sets a child control to display inside the cell.

Instance member DataGridView

DataGridView: Returns the DataGridView control associated with this DataGridViewCell.

Instance member DefaultNewRowValue

Object: Returns the default value for a cell in the row for new records.

Instance member Displayed

Boolean: Returns a value that indicates whether the cell is currently displayed.

Instance member Editable

Boolean: Returns whether the cell can be edited.

Instance member EditedFormattedValue

Object: Returns the current, formatted value of the cell, regardless of whether the cell is in edit mode and the value has not been committed.

Throws:

Instance member EditType

Type: Returns the type of the cell's hosted editing control.

Instance member ErrorText

String: Returns or sets the text describing an error condition associated with the cell.

Instance member FormattedValue

Object: Returns the value of the cell as formatted for display.

Throws:

Instance member FormattedValueType

Type: Returns the type of the formatted value associated with the cell.

Protected member FormattedValueTypeConverter

TypeConverter: Returns the type converter to use to convert a formatted value to the cell's value type.

Instance member Frozen

Boolean: Returns a value indicating whether the cell is frozen.

Instance member HasStyle

Boolean: Returns true it the Style property has been set.

Instance member HasUserData

Boolean: Checks if the UserData dynamic object was created and has any value.

Instance member Height

Int32: Returns the height of the cell.

Instance member InheritedState

DataGridViewElementStates: Returns the current state of the cell as inherited from the state of its row and column.

Throws:

Instance member InheritedStyle

DataGridViewCellStyle: Returns the style currently applied to the cell.

Throws:

Instance member IsCurrentCell

Boolean: Returns whether this is the current cell in the DataGridView.

Instance member IsInEditMode

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

Instance member OwningColumn

DataGridViewColumn: Returns the column that contains this cell.

Instance member OwningRow

DataGridViewRow: Returns the row that contains this cell.

Instance member ReadOnly

Boolean: Returns or sets whether the cell's data can be edited.

Instance member Resizable

Boolean: Returns a value indicating whether the cell can be resized.

Instance member RowIndex

Int32: Returns the index of the cell's parent row.

Instance member Selected

Boolean: Returns or sets whether the cell has been selected.

Instance member Size

Size: Returns the size of the cell.

Instance member Style

DataGridViewCellStyle: Returns or sets the style for the cell.

Instance member Tag

Object: Returns or sets the object that contains supplemental data about the cell. (Default: null)

Instance member ToolTipText

String: Returns or sets the ToolTip text associated with this cell.

Instance member UserData

Object: Returns a dynamic object that can be used to store custom data in relation to this cell.

Instance member UserPaint

Boolean: Enables or disables the user paint feature for this cell. When UserPaint is true, the application can handle the CellPaint event to draw custom content in the cell. (Default: False)

Instance member Value

Object: Returns or sets the value associated with this cell.

Throws:

Instance member ValueType

Type: Returns or sets the data type of the values in the cell.

Protected member ValueTypeConverter

TypeConverter: Return the type converter to use to convert the value in the cell to the formatted value.

Instance member Visible

Boolean: Returns a value indicating whether the cell is in a row or column that has been hidden.

Instance member Width

Int32: Returns the width of the cell.

Methods

Instance member Clone()

Creates a copy of this cell.

Returns: DataGridViewCell. The cloned DataGridViewCell.

Protected member CompareValue(newValue, oldValue)

Compares the new value being assigned to the cell with the previous value.

ParameterTypeDescription
newValueObjectNew value being assigned to the cell.
oldValueObjectCurrent value assigned to the cell being replaced by newValue

Returns: Boolean. true if newValue and oldValue are different.

Instance member CreateEditingControl()

Creates a new instance of the edit control used to edit values in this cell.

Returns: Control.

Protected member Dispose(disposing)

Releases the resources used by the DataGridViewCell.

ParameterTypeDescription
disposingBooleantrue when this method is called by the application rather than a finalizer.

Protected member GetClipboardContent(rowIndex, firstCell, lastCell, inFirstRow, inLastRow, format)

Returns the formatted value of the cell to copy to the Clipboard.

ParameterTypeDescription
rowIndexInt32The zero-based index of the row containing the cell.
firstCellBooleantrue to indicate that the cell is in the first column of the region defined by the selected cells; otherwise, false.
lastCellBooleantrue to indicate that the cell is the last column of the region defined by the selected cells; otherwise, false.
inFirstRowBooleantrue to indicate that the cell is in the first row of the region defined by the selected cells; otherwise, false.
inLastRowBooleantrue to indicate that the cell is in the last row of the region defined by the selected cells; otherwise, false.
formatStringThe current format string of the cell.

Returns: Object. An Object that represents the value of the cell to copy to the Clipboard.

Throws:

Protected member GetCommand()

Returns the command bound to the cell.

Returns: ICommand. The value contained in the DataGridViewCell.

Instance member GetEditedFormattedValue()

Returns the current, formatted value of the cell, regardless the cell being in edit mode.

Returns: Object. The current, formatted value of the DataGridViewCell.

Throws:

Protected member GetErrorText()

Returns a string that represents the error for the cell.

Returns: String. A string that describes the error for the current DataGridViewCell.

Protected member GetFormattedValue(value, cellStyle, valueTypeConverter, formattedTypeConverter)

Returns the value of the cell formatted for the client.

ParameterTypeDescription
valueObjectThe value to be formatted.
cellStyle by referenceDataGridViewCellStyleThe DataGridViewCellStyle in for the cell.
valueTypeConverterTypeConverterA TypeConverter providing custom conversion from the formatted type to the value type, or null if no custom conversion is required.
formattedTypeConverterTypeConverterA TypeConverter providing custom conversion from the value type to the formatted type, or null if no custom conversion is required.

Returns: Object. The value of the cell or null if the cell does not belong to a DataGridView control.

Throws:

Instance member GetInheritedContextMenu()

Returns the inherited ContextMenu for the current cell.

Returns: ContextMenu. A ContextMenu instance if the DataGridViewCell, or the owner DataGridViewRow, or the owner DataGridViewColumn, or the owner DataGridView has a ContextMenu assigned; otherwise, null.

Instance member GetInheritedState()

Returns a value indicating the current state of the cell as inherited from the state of its row and column.

Returns: DataGridViewElementStates. A combination of DataGridViewElementStates values representing the current state of the cell.

Instance member GetInheritedStyle(includeVisualProperties)

Returns the style applied to the cell.

ParameterTypeDescription
includeVisualPropertiesBooleantrue to include inherited visual properties; otherwise, false to include only formatting properties.

Returns: DataGridViewCellStyle. A DataGridViewCellStyle that includes the style settings of the cell inherited from the cell's parent row, column, and DataGridView.

Throws:

Protected member GetToolTipText()

Returns a string that represents the tooltip text for the cell.

Returns: String. A string that describes the tooltip text for the current DataGridViewCell.

Protected member GetValue()

Returns the value of the cell.

Returns: Object. The value contained in the DataGridViewCell.

Instance member InitializeEditingControl(editor, style)

Initializes the control used to edit the cell.

ParameterTypeDescription
editorControlThe Control that is used to edit the cell.
styleDataGridViewCellStyleThe DataGridViewCellStyle that is in effect for the cell entering edit mode.

Throws:

Instance member OnCellFormatting(e)

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

ParameterTypeDescription
eDataGridViewCellFormattingEventArgsA DataGridViewCellFormattingEventArgs that contains the event data.

Instance member OnClick(e)

Raised when the user clicks on a cell.

ParameterTypeDescription
eDataGridViewCellEventArgsA DataGridViewCellEventArgs that contains the event data.

Protected member OnDataGridViewChanged()

Called when the element is associated with a different DataGridView.

Instance member OnDoubleClick(e)

Raised when the user double-clicks on a cell.

ParameterTypeDescription
eDataGridViewCellEventArgsA DataGridViewCellEventArgs that contains the event data.

Instance member OnEnter(e)

Raised when the cell becomes the active cell.

ParameterTypeDescription
eDataGridViewCellEventArgsA DataGridViewCellEventArgs that contains the event data.

Instance member OnKeyDown(e)

Raised when the user types on the keyboard while the grid has the focus and it's not in edit more.

ParameterTypeDescription
eKeyEventArgsA KeyEventArgs that contains the event data.

Instance member OnLeave(e)

Raised when the cell is not the active cell anymore.

ParameterTypeDescription
eDataGridViewCellEventArgsA DataGridViewCellEventArgs that contains the event data.

Instance member OnMouseClick(e)

Raised when the user clicks or taps on a cell.

ParameterTypeDescription
eDataGridViewCellMouseEventArgsA DataGridViewCellMouseEventArgs that contains the event data.

Instance member OnMouseDoubleClick(e)

Raised when the user double-clicks or double-taps on a cell.

ParameterTypeDescription
eDataGridViewCellMouseEventArgsA DataGridViewCellMouseEventArgs that contains the event data.

Instance member ParseFormattedValue(value, cellStyle, formattedTypeConverter, valueTypeConverter)

Converts a value to the actual cell value.

ParameterTypeDescription
valueObjectThe display value of the cell.
cellStyleDataGridViewCellStyleThe DataGridViewCellStyle in effect for the cell.
formattedTypeConverterTypeConverterA TypeConverter for the display value type, or null to use the default converter.
valueTypeConverterTypeConverterA TypeConverter for the cell value type, or null to use the default converter.

Returns: Object. The cell value.

Throws:

Protected member RaiseCellCommandChanged(e)

Fires the CellCommandChanged event.

ParameterTypeDescription
eDataGridViewCellEventArgsA DataGridViewCellEventArgs that contains the event data.

Instance member ResetReadOnly()

Resets the ReadOnly state to inherit its value from the OwningColumn, OwningRowand the DataGridView.

Protected member SetCommand(command)

Sets the command for the cell.

ParameterTypeDescription
commandICommandThe cell command to set.

Returns: Boolean. True if the value has been set, otherwise false.

Protected member SetValue(value)

Sets the value of the cell.

ParameterTypeDescription
valueObjectThe cell value to set.

Returns: Boolean. True if the value has been set, otherwise false.

Instance member ShouldUpdate()

Indicates whether the cell data should be updated on the client even if the user didn't change the value when editing. Since 3.2.5

Returns: Boolean. true to force the cell to update the client.

Used to allow the server to update the cell after editing mode is terminated and the user didn't change anything. For example, a password cell can be obfuscated, or a custom cell may need to always format the rendered value when terminating edit mode.

Instance member Update()

Updates the cell on the client.

Inherited By

NameDescription
DataGridViewButtonCellDisplays a button widget in a DataGridViewCell cell.
DataGridViewCheckBoxCellDisplays a CheckBox icon (not the actual control) in a DataGridViewCell cell.
DataGridViewComboBoxCellDisplays an editable ComboBox control in a DataGridViewCell cell when in edit mode.
DataGridViewDateTimePickerCellDisplays an editable DateTimePicker control in a DataGridViewCell cell when in edit mode.
DataGridViewImageCellDisplays an image in a DataGridViewCell cell.
DataGridViewLinkCellDisplays a link widget in a DataGridViewCell cell.
DataGridViewMaskedTextBoxCellDisplays an editable MaskedTextBox control in a DataGridViewCell cell when in edit mode.
DataGridViewNumericUpDownCellDisplays an editable NumericUpDown control in a DataGridViewCell cell when in edit mode.
DataGridViewTextBoxCellDisplays an editable TextBox control in a DataGridViewCell cell when in edit mode.
DataGridViewColumnHeaderCellRepresents a column header in a DataGridView control.
DataGridViewHeaderCellContains functionality common to row header cells and column header cells.
DataGridViewRowHeaderCellRepresents a row header of a DataGridView control.

Implements

NameDescription
IUserDataProvides access to the UserData and Tag properties associated to the component implementing this interface.
ICommandSourceDefines an object that can invoke a Command.