# DataGridViewColumnHeaderCell

Namespace: **Wisej.Web**

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

* [DataGridViewElement](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewelement.md)
  * [DataGridViewCell](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcell.md)
    * [DataGridViewHeaderCell](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewheadercell.md)
      * [DataGridViewColumnHeaderCell](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcolumnheadercell.md)

Represents a column header in a [DataGridView](/api/wisej.web/lists-and-grids/datagridview.md) control.

{% tabs %}
{% tab title="C#" %}

```csharp
public class DataGridViewColumnHeaderCell : DataGridViewHeaderCell
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class DataGridViewColumnHeaderCell
    Inherits DataGridViewHeaderCell
```

{% endtab %}
{% endtabs %}

## Constructors

### ![](/files/hsR4ok3152WyAf8J2C1u) DataGridViewColumnHeaderCell()

Initializes a new instance of [DataGridViewColumnHeaderCell](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcolumnheadercell.md).

## Properties

### ![](/files/hsR4ok3152WyAf8J2C1u) ErrorText

[String](https://docs.microsoft.com/dotnet/api/system.string): This property is not relevant for this class.

### ![](/files/hsR4ok3152WyAf8J2C1u) SortGlyphDirection

[SortOrder](/api/wisej.web/enumerations/wisej.web.sortorder.md): Returns or sets a value indicating which sort glyph is displayed.

**Throws:**

* [InvalidOperationException](https://docs.microsoft.com/dotnet/api/system.invalidoperationexception)\
  When setting this property, the value of either the [OwningColumn](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcell.md#owningcolumn) property or the [DataGridView](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewelement.md#datagridview) property of the cell is null. or When changing the value of this property, the specified value is not [None](/api/wisej.web/enumerations/wisej.web.sortorder.md#fields) and the value of the [SortMode](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcolumn.md#sortmode) property of the owning column is [NotSortable](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcolumnsortmode.md#fields).

## Methods

### ![](/files/lzopMboA31bVq8UIcbT3) GetClipboardContent(rowIndex, firstCell, lastCell, inFirstRow, inLastRow, format)

Returns the formatted value of the cell to copy to the [Clipboard](/api/wisej.web/general/wisej.web.clipboard.md).

| Parameter      | Type                                                            | Description                                                                                                          |
| -------------- | --------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| **rowIndex**   | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)     | The zero-based index of the row containing the cell.                                                                 |
| **firstCell**  | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | true to indicate that the cell is in the first column of the region defined by the selected cells; otherwise, false. |
| **lastCell**   | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | true to indicate that the cell is the last column of the region defined by the selected cells; otherwise, false.     |
| **inFirstRow** | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | true to indicate that the cell is in the first row of the region defined by the selected cells; otherwise, false.    |
| **inLastRow**  | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | true to indicate that the cell is in the last row of the region defined by the selected cells; otherwise, false.     |
| **format**     | [String](https://docs.microsoft.com/dotnet/api/system.string)   | The current format string of the cell.                                                                               |

**Returns:** [Object](https://docs.microsoft.com/dotnet/api/system.object). An [Object](https://docs.microsoft.com/dotnet/api/system.object) that represents the value of the cell to copy to the [Clipboard](/api/wisej.web/general/wisej.web.clipboard.md).

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception)*rowIndex* is less than 0 or greater than or equal to the number of rows in the control.
* [InvalidOperationException](https://docs.microsoft.com/dotnet/api/system.invalidoperationexception)\
  The value of the cell's [DataGridView](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewelement.md#datagridview) property is null.-or-[ColumnIndex](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcell.md#columnindex) is less than 0, indicating that the cell is a row header cell.
* [Exception](https://docs.microsoft.com/dotnet/api/system.exception)\
  Formatting failed and either there is no handler for the [DataError](/api/wisej.web/lists-and-grids/datagridview.md#dataerror) event of the [DataGridView](/api/wisej.web/lists-and-grids/datagridview.md) control or the handler set the [ThrowException](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewdataerroreventargs.md#throwexception) property to true. The exception object can typically be cast to type [FormatException](https://docs.microsoft.com/dotnet/api/system.formatexception).

### ![](/files/lzopMboA31bVq8UIcbT3) GetErrorText()

This method is not relevant for this class.

**Returns:** [String](https://docs.microsoft.com/dotnet/api/system.string).

### ![](/files/hsR4ok3152WyAf8J2C1u) GetInheritedStyle(includeVisualProperties)

Returns the style applied to the column header cell.

| Parameter                   | Type                                                            | Description                                                                                          |
| --------------------------- | --------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| **includeVisualProperties** | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | true to include inherited visual properties; otherwise, false to include only formatting properties. |

**Returns:** [DataGridViewCellStyle](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcellstyle.md). A [DataGridViewCellStyle](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcellstyle.md) that includes the style of the column header cell and the style inherited from the [DataGridView](/api/wisej.web/lists-and-grids/datagridview.md).

**Throws:**

* [InvalidOperationException](https://docs.microsoft.com/dotnet/api/system.invalidoperationexception)\
  The cell has no associated [DataGridView](/api/wisej.web/lists-and-grids/datagridview.md).

### ![](/files/lzopMboA31bVq8UIcbT3) GetValue()

Returns the value of the cell.

**Returns:** [Object](https://docs.microsoft.com/dotnet/api/system.object). The value contained in the [DataGridViewColumnHeaderCell](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcolumnheadercell.md).

### ![](/files/hsR4ok3152WyAf8J2C1u) Render(data, styles, errors, tooltips)

Renders the cell's value and style.

| Parameter    | Type                                                          | Description                                                     |
| ------------ | ------------------------------------------------------------- | --------------------------------------------------------------- |
| **data**     | [Object](https://docs.microsoft.com/dotnet/api/system.object) | The data collection to render the cell's value into.            |
| **styles**   | [Object](https://docs.microsoft.com/dotnet/api/system.object) | The styles collection to render the cell's styles into.         |
| **errors**   | [Object](https://docs.microsoft.com/dotnet/api/system.object) | The errors collection to render the cell's error text into.     |
| **tooltips** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | The tooltips collection to render the cell's tooltip text into. |

### ![](/files/lzopMboA31bVq8UIcbT3) SetValue(value)

Sets the value of the cell.

| Parameter | Type                                                          | Description            |
| --------- | ------------------------------------------------------------- | ---------------------- |
| **value** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | The cell value to set. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if the value has been set; otherwise, false.

## Implements

| Name                                                                    | Description                                                                                                     |
| ----------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| [IUserData](/api/wisej.web/interfaces/wisej.web.iuserdata.md)           | Provides access to the `UserData` and `Tag` properties associated to the component implementing this interface. |
| [ICommandSource](/api/wisej.web/interfaces/wisej.web.icommandsource.md) | Defines an object that can invoke a [Command](/api/wisej.web/interfaces/wisej.web.icommandsource.md#command).   |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcolumnheadercell.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
