# DataGridViewRow

URL: https://docs.wisej.com/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewrow

Version: 4.1
Namespace: **Wisej.Web**

Assembly: **Wisej.Framework** (4.1.0.0)

- [DataGridViewElement](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewelement)
- [DataGridViewBand](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewband)
- [DataGridViewRow](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewrow)
Represents a row in aDataGridView control.

- C# - VB.NET

```csharp
public class DataGridViewRow : DataGridViewBand
```

```visual
Public Class DataGridViewRow
    Inherits DataGridViewBand
```

## Constructors

### ![Instance member](/img/api/instance.png) DataGridViewRow()

Initializes a new instance of the [DataGridViewRow](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewrow) class.

### ![Instance member](/img/api/instance.png) DataGridViewRow(dataGridView)

Initializes a new instance of the [DataGridViewRow](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewrow) class bound to aDataGridView . This constructor is used to create the RowTemplate object at design time.

| Name | Type | Description | **dataGridView** | DataGridView | 

## Properties

### ![Instance member](/img/api/instance.png) CellCount

[Int32](https://docs.microsoft.com/dotnet/api/system.int32) : Returns the number of cells in the cell collection without forcing the creation of the collection.

### ![Instance member](/img/api/instance.png) Cells

[DataGridViewCellCollection](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcellcollection) : Returns the collection of cells that populate the row.

### ![Instance member](/img/api/instance.png) ChildRows

[DataGridViewChildRowCollection](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewchildrowcollection) : Returns the collection of child rows.

### ![Instance member](/img/api/instance.png) ContextMenu

[ContextMenu](/api/wisej.web/menus/wisej.web.contextmenu) : Returns or sets the context menu for the row. (Default: `null` )

### ![Instance member](/img/api/instance.png) DataBoundItem

[Object](https://docs.microsoft.com/dotnet/api/system.object) : Returns the data-bound object that populated the row.

### ![Instance member](/img/api/instance.png) DefaultCellStyle

[DataGridViewCellStyle](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcellstyle) : Returns or sets the default styles for the row, which are used to render cells in the row unless the styles are overridden.

### ![Instance member](/img/api/instance.png) DefaultMinimumSize

[Int32](https://docs.microsoft.com/dotnet/api/system.int32) : Returns the default minimum height saving an entry in the property store.

### ![Instance member](/img/api/instance.png) DefaultSize

[Int32](https://docs.microsoft.com/dotnet/api/system.int32) : Returns the default row height.

### ![Instance member](/img/api/instance.png) Displayed

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) : Returns a value indicating whether this row is displayed on the screen.

### ![Instance member](/img/api/instance.png) ErrorText

[String](https://docs.microsoft.com/dotnet/api/system.string) : Returns or sets the error message text for row-level errors. (Default: `""` )

### ![Instance member](/img/api/instance.png) Frozen

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) : Returns or sets whether a row will move when a user scrolls theDataGridView control vertically. (Default: `False` )

### ![Instance member](/img/api/instance.png) HeaderCell

[DataGridViewRowHeaderCell](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewrowheadercell) : Returns or sets the row's header cell.

### ![Instance member](/img/api/instance.png) Height

[Int32](https://docs.microsoft.com/dotnet/api/system.int32) : Returns or sets the current height of the row.

### ![Instance member](/img/api/instance.png) IsChild

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) : Returns whether the row is a child row.

### ![Instance member](/img/api/instance.png) IsExpanded

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) : Returns or sets whether the parent row is expanded.

### ![Instance member](/img/api/instance.png) IsNewRow

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) : Returns a value indicating whether the row is the row for new records.

### ![Instance member](/img/api/instance.png) IsParent

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) : Returns or sets whether the row is a parent row and can be expanded.

Setting this property to true when the row doesn't have any children, will cause the row to expand anyway and request the child rows from the server.

### ![Instance member](/img/api/instance.png) IsRow

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) : Returns true when the implementation class is DataGridViewRow.

### ![Instance member](/img/api/instance.png) Item(column)

[DataGridViewCell](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcell) : Returns or sets the cell at the provided index location.

**Throws:**

- [InvalidOperationException](https://docs.microsoft.com/dotnet/api/system.invalidoperationexception) The specified cell when setting this property already belongs to aDataGridView control, or the specified cell when setting this property already belongs to a [DataGridViewRow](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewrow)
- [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception) The specified *column* does not belong to the sameDataGridView that owns the cells.
- [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception) The index of the specified *column* is less than 0 or is equal to or greater than the number of cells in the collection.

### ![Instance member](/img/api/instance.png) Item(index)

[DataGridViewCell](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcell) : Returns or sets the cell at the provided index location.

**Throws:**

- [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception) The specified value when setting this property is null.
- [InvalidOperationException](https://docs.microsoft.com/dotnet/api/system.invalidoperationexception) The specified cell when setting this property already belongs to aDataGridView control, or the specified cell when setting this property already belongs to a [DataGridViewRow](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewrow) .
- [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception)*index* is less than 0 or *index* is equal to or greater than the number of cells in the collection.

### ![Instance member](/img/api/instance.png) Item(columnName)

[DataGridViewCell](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcell) : Returns or sets the cell in the column with the provided name.

**Throws:**

- [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception)*columnName* does not match the name of any columns in the control.
- [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception) The specified value when setting this property is null.
- [InvalidOperationException](https://docs.microsoft.com/dotnet/api/system.invalidoperationexception) The specified cell when setting this property already belongs to aDataGridView control, or the specified cell when setting this property already belongs to a [DataGridViewRow](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewrow) .

### ![Instance member](/img/api/instance.png) Level

[Int32](https://docs.microsoft.com/dotnet/api/system.int32) : Returns the child nesting level of this row.

### ![Instance member](/img/api/instance.png) MaximumHeight

[Int32](https://docs.microsoft.com/dotnet/api/system.int32) : Returns or sets the maximum height of the row.

**Throws:**

- [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception) The specified value when setting this property is less than 0 or greater than 32000.

### ![Instance member](/img/api/instance.png) MinimumHeight

[Int32](https://docs.microsoft.com/dotnet/api/system.int32) : Returns or sets the minimum height of the row.

**Throws:**

- [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception) The specified value when setting this property is less than 2 or greater than 32000.

### ![Instance member](/img/api/instance.png) ParentRow

[DataGridViewRow](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewrow) : Returns or sets the parent row.

When a row has a parent row, it is displayed as child row in a tree-like structure. To enumerate all the child rows use the [ChildRows](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewrow#childrows) property.

When changing the parent row, Wisej tries to enforce the correct sequence of rows in the structure like this:

- The preceding rows with null parent will also become child rows using the same parent.
- If the parent being assigned is not a direct ancestor, it will throw an exception.
- When setting the parent to null, all the following rows that are not descendants will also lose their parent.
- When adding or inserting a row, the new row will receive the same parent as the row at the location it is being inserted at. **Throws:**
- [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception) When the parent is not a valid ancestor and it would cause break in the tree sequence.

### ![Instance member](/img/api/instance.png) ReadOnly

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) : Returns or sets whether the row is read-only. (Default: `False` )

### ![Instance member](/img/api/instance.png) Resizable

[DataGridViewTriState](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewtristate) : Returns or sets whether users can resize the row or indicating that the behavior is inherited from the [AllowUserToResizeRows](/api/wisej.web/lists-and-grids/datagridview/#allowusertoresizerows) property.

### ![Instance member](/img/api/instance.png) RootRow

[DataGridViewRow](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewrow) : Returns the parent top-level parent row.

### ![Instance member](/img/api/instance.png) Selected

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) : Returns or sets whether the row is selected.

### ![Instance member](/img/api/instance.png) Visible

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) : Returns or sets whether the row is visible. (Default: `True` )

## Methods

### ![Instance member](/img/api/instance.png) Clone()

Creates a copy of this row.

**Returns:**[Object](https://docs.microsoft.com/dotnet/api/system.object) . The cloned [DataGridViewRow](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewrow) .

### ![Instance member](/img/api/instance.png) Collapse()

Collapse the row and hides all the child rows.

### ![Instance member](/img/api/instance.png) CollapseAll()

Collapse the row and all the child rows.

### ![Instance member](/img/api/instance.png) ContainsRow(row)

Checks whether the specified row is a child of this row, or a child of a child of this row.

| Parameter | Type | Description | **row** | [DataGridViewRow](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewrow) | The row to find in the child row collections. 

**Returns:**[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) . True if the specified row is a child of this row, or a child of a child of this row.

### ![Instance member](/img/api/instance.png) Expand()

Expands the row and shows all the child rows.

### ![Instance member](/img/api/instance.png) ExpandAll()

Expands the row and all the child rows, showing all the child rows at all levels.

### ![Protected member](/img/api/protected.png) GetErrorText()

Returns the error text for the row at the specified index.

**Returns:**[String](https://docs.microsoft.com/dotnet/api/system.string) . A string that describes the error of the row at the specified index.

### ![Instance member](/img/api/instance.png) ResetHeight()

Resets the row height.

### ![Instance member](/img/api/instance.png) SetValues(values)

Sets the values of the row's cells.

| Parameter | Type | Description | **values** | [Object[]](https://docs.microsoft.com/dotnet/api/system.object) | One or more objects that represent the cell values in the row. or An [Array](https://docs.microsoft.com/dotnet/api/system.array) of [Object](https://docs.microsoft.com/dotnet/api/system.object) values. 

**Returns:**[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) . True if at least one of the values has been set; otherwise, false.

**Throws:**

- [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)*values* is null.
- [InvalidOperationException](https://docs.microsoft.com/dotnet/api/system.invalidoperationexception) This method is called when the associatedDataGridView is operating in virtual mode.

### ![Instance member](/img/api/instance.png) Update()

Updates the cell on the client.

## Inherited By

| Name | Description | [DataGridViewSummaryRow](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewsummaryrow) | Represents a summary row in aDataGridView control. 

## Implements

| Name | Description | [IUserData](/api/wisej.web/interfaces/wisej.web.iuserdata) | Provides access to the `UserData` and `Tag` properties associated to the component implementing this interface.
