# ListControlExtensions

Namespace: **Wisej.Web.Markup**

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

Adds [fluent markup](https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/markup/markup) extension methods to the [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md) class.

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

```csharp
public class ListControlExtensions
```

{% endtab %}

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

```visual-basic
Public Class ListControlExtensions
```

{% endtab %}
{% endtabs %}

## Methods

### ![](/files/lIX317sDtMTZJBi9oSIx) AllowHtml\<TListControl>(listControl, value)

Sets the AllowHtml property of the specified [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md).

| Parameter        | Type                                                                                       | Description                                                                                                   |
| ---------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
| **TListControl** |                                                                                            | The type of the list control, must inherit from [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md). |
| **listControl**  | [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md) | The list control for which to set the AllowHtml property.                                                     |
| **value**        | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                            | A boolean indicating whether HTML content is allowed in the list items.                                       |

**Returns:** [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md). The modified list control with the updated AllowHtml property.

This method allows you to enable or disable HTML content in the list items.

```csharp

myListControl.AllowHtml(true);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) BorderStyle\<TListControl>(listControl, borderStyle)

Sets the BorderStyle property of the specified [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md).

| Parameter        | Type                                                                                       | Description                                                                                                   |
| ---------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
| **TListControl** |                                                                                            | The type of the list control, must inherit from [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md). |
| **listControl**  | [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md) | The list control for which to set the BorderStyle property.                                                   |
| **borderStyle**  | [BorderStyle](/api/wisej.web/enumerations/wisej.web.borderstyle.md)                        | The [BorderStyle](#borderstyle``1) value to set for the list control.                                         |

**Returns:** [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md). The modified list control with the updated BorderStyle property.

This method allows you to set the border style for the list control.

```csharp

myListControl.BorderStyle(BorderStyle.FixedSingle);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) DataSource\<TListControl>(listControl, value)

Sets the DataSource property of the specified [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md).

| Parameter        | Type                                                                                       | Description                                                                                                   |
| ---------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
| **TListControl** |                                                                                            | The type of the list control, must inherit from [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md). |
| **listControl**  | [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md) | The list control for which to set the DataSource property.                                                    |
| **value**        | [Object](https://docs.microsoft.com/dotnet/api/system.object)                              | The data source to bind to the list control.                                                                  |

**Returns:** [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md). The modified list control with the updated DataSource property.

This method allows you to set the data source for the list control.

```csharp

myListControl.DataSource(myDataSource);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) DisplayMember\<TListControl>(listControl, value)

Sets the DisplayMember property of the specified [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md).

| Parameter        | Type                                                                                       | Description                                                                                                   |
| ---------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
| **TListControl** |                                                                                            | The type of the list control, must inherit from [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md). |
| **listControl**  | [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md) | The list control for which to set the DisplayMember property.                                                 |
| **value**        | [String](https://docs.microsoft.com/dotnet/api/system.string)                              | The property to display for the list items.                                                                   |

**Returns:** [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md). The modified list control with the updated DisplayMember property.

This method allows you to set the property to display for the list items.

```csharp

myListControl.DisplayMember("Name");

```

### ![](/files/lIX317sDtMTZJBi9oSIx) FormatInfo\<TListControl>(listControl, provider)

Sets the FormatInfo property of the specified [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md).

| Parameter        | Type                                                                                       | Description                                                                                                               |
| ---------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |
| **TListControl** |                                                                                            | The type of the list control, must inherit from [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md).             |
| **listControl**  | [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md) | The list control for which to set the FormatInfo property.                                                                |
| **provider**     | [IFormatProvider](https://docs.microsoft.com/dotnet/api/system.iformatprovider)            | The [IFormatProvider](https://docs.microsoft.com/dotnet/api/system.iformatprovider) to use for formatting the list items. |

**Returns:** [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md). The modified list control with the updated FormatInfo property.

This method allows you to set the format provider for the list control.

```csharp

myListControl.FormatInfo(CultureInfo.CurrentCulture);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) FormatString\<TListControl>(listControl, format)

Sets the FormatString property of the specified [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md).

| Parameter        | Type                                                                                       | Description                                                                                                   |
| ---------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
| **TListControl** |                                                                                            | The type of the list control, must inherit from [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md). |
| **listControl**  | [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md) | The list control for which to set the FormatString property.                                                  |
| **format**       | [String](https://docs.microsoft.com/dotnet/api/system.string)                              | The format string to use for displaying the list items.                                                       |

**Returns:** [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md). The modified list control with the updated FormatString property.

This method allows you to set the format string for the list control.

```csharp

myListControl.FormatString("C2");

```

### ![](/files/lIX317sDtMTZJBi9oSIx) FormattingEnabled\<TListControl>(listControl, value)

Sets the FormattingEnabled property of the specified [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md).

| Parameter        | Type                                                                                       | Description                                                                                                   |
| ---------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
| **TListControl** |                                                                                            | The type of the list control, must inherit from [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md). |
| **listControl**  | [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md) | The list control for which to set the FormattingEnabled property.                                             |
| **value**        | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                            | A boolean indicating whether formatting is enabled for the list items.                                        |

**Returns:** [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md). The modified list control with the updated FormattingEnabled property.

This method allows you to enable or disable formatting for the list control.

```csharp

myListControl.FormattingEnabled(true);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) IconMember\<TListControl>(listControl, value)

Sets the IconMember property of the specified [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md).

| Parameter        | Type                                                                                       | Description                                                                                                   |
| ---------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
| **TListControl** |                                                                                            | The type of the list control, must inherit from [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md). |
| **listControl**  | [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md) | The list control for which to set the IconMember property.                                                    |
| **value**        | [String](https://docs.microsoft.com/dotnet/api/system.string)                              | The property to use as the icon for the list items.                                                           |

**Returns:** [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md). The modified list control with the updated IconMember property.

This method allows you to set the property to use as the icon for the list items.

```csharp

myListControl.IconMember("IconPath");

```

### ![](/files/lIX317sDtMTZJBi9oSIx) Invalid\<TListControl>(listControl, value)

Sets the Invalid property of the specified [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md).

| Parameter        | Type                                                                                       | Description                                                                                                   |
| ---------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
| **TListControl** |                                                                                            | The type of the list control, must inherit from [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md). |
| **listControl**  | [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md) | The list control for which to set the Invalid property.                                                       |
| **value**        | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                            | A boolean indicating whether the list control is in an invalid state.                                         |

**Returns:** [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md). The modified list control with the updated Invalid property.

This method allows you to set the invalid state for the list control.

```csharp

myListControl.Invalid(true);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) InvalidMessage\<TListControl>(listControl, message)

Sets the InvalidMessage property of the specified [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md).

| Parameter        | Type                                                                                       | Description                                                                                                   |
| ---------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
| **TListControl** |                                                                                            | The type of the list control, must inherit from [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md). |
| **listControl**  | [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md) | The list control for which to set the InvalidMessage property.                                                |
| **message**      | [String](https://docs.microsoft.com/dotnet/api/system.string)                              | The message to display when an invalid operation occurs in the list control.                                  |

**Returns:** [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md). The modified list control with the updated InvalidMessage property.

This method allows you to set a custom invalid message for the list control.

```csharp

myListControl.InvalidMessage("Invalid selection.");

```

### ![](/files/lIX317sDtMTZJBi9oSIx) OnSelectedValueChanged\<TListControl>(listControl, action)

Attaches an event handler for the SelectedValueChanged event of the specified [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md).

| Parameter        | Type                                                                                       | Description                                                                                                   |
| ---------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
| **TListControl** |                                                                                            | The type of the list control, must inherit from [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md). |
| **listControl**  | [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md) | The list control to attach the event handler to.                                                              |
| **action**       | [Action\<TListControl>](https://docs.microsoft.com/dotnet/api/system.action-1)             | An action to execute when the SelectedValue property changes.                                                 |

**Returns:** [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md). The modified list control with the attached SelectedValueChanged event handler.

This method allows you to execute a custom action whenever the SelectedValue property of the list control changes.

```csharp

myListControl.OnSelectedValueChanged(lc =>
{
AlertBox.Show("Selected value changed!");
});

```

### ![](/files/lIX317sDtMTZJBi9oSIx) PrefetchItems\<TListControl>(listControl, count)

Sets the PrefetchItems property of the specified [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md).

| Parameter        | Type                                                                                       | Description                                                                                                   |
| ---------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
| **TListControl** |                                                                                            | The type of the list control, must inherit from [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md). |
| **listControl**  | [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md) | The list control for which to set the PrefetchItems property.                                                 |
| **count**        | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                                | The number of items to prefetch for the list control.                                                         |

**Returns:** [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md). The modified list control with the updated PrefetchItems property.

This method allows you to set the number of items to prefetch for the list control.

```csharp

myListControl.PrefetchItems(50);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) SelectedIndex\<TListControl>(listControl, value)

Sets the SelectedIndex property of the specified [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md).

| Parameter        | Type                                                                                       | Description                                                                                                   |
| ---------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
| **TListControl** |                                                                                            | The type of the list control, must inherit from [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md). |
| **listControl**  | [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md) | The list control for which to set the SelectedIndex property.                                                 |
| **value**        | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                                | The index to select in the list control.                                                                      |

**Returns:** [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md). The modified list control with the updated SelectedIndex property.

This method allows you to set the selected index for the list control.

```csharp

myListControl.SelectedIndex(0);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) SelectedValue\<TListControl>(listControl, value)

Sets the SelectedValue property of the specified [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md).

| Parameter        | Type                                                                                       | Description                                                                                                   |
| ---------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
| **TListControl** |                                                                                            | The type of the list control, must inherit from [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md). |
| **listControl**  | [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md) | The list control for which to set the SelectedValue property.                                                 |
| **value**        | [Object](https://docs.microsoft.com/dotnet/api/system.object)                              | The value to select in the list control.                                                                      |

**Returns:** [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md). The modified list control with the updated SelectedValue property.

This method allows you to set the selected value for the list control.

```csharp

myListControl.SelectedValue(someValue);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) ShowToolTips\<TListControl>(listControl, value)

Sets the ShowToolTips property of the specified [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md).

| Parameter        | Type                                                                                       | Description                                                                                                   |
| ---------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
| **TListControl** |                                                                                            | The type of the list control, must inherit from [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md). |
| **listControl**  | [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md) | The list control for which to set the ShowToolTips property.                                                  |
| **value**        | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                            | A boolean indicating whether tooltips should be shown for the list items.                                     |

**Returns:** [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md). The modified list control with the updated ShowToolTips property.

This method allows you to enable or disable tooltips for the list items.

```csharp

myListControl.ShowToolTips(true);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) ToolTipMember\<TListControl>(listControl, value)

Sets the ToolTipMember property of the specified [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md).

| Parameter        | Type                                                                                       | Description                                                                                                   |
| ---------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
| **TListControl** |                                                                                            | The type of the list control, must inherit from [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md). |
| **listControl**  | [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md) | The list control for which to set the ToolTipMember property.                                                 |
| **value**        | [String](https://docs.microsoft.com/dotnet/api/system.string)                              | The property to use as the tooltip for the list items.                                                        |

**Returns:** [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md). The modified list control with the updated ToolTipMember property.

This method allows you to set the property to use as the tooltip for the list items.

```csharp

myListControl.ToolTipMember("Description");

```

### ![](/files/lIX317sDtMTZJBi9oSIx) ValueMember\<TListControl>(listControl, value)

Sets the ValueMember property of the specified [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md).

| Parameter        | Type                                                                                       | Description                                                                                                   |
| ---------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
| **TListControl** |                                                                                            | The type of the list control, must inherit from [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md). |
| **listControl**  | [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md) | The list control for which to set the ValueMember property.                                                   |
| **value**        | [String](https://docs.microsoft.com/dotnet/api/system.string)                              | The property to use as the value for the list items.                                                          |

**Returns:** [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md). The modified list control with the updated ValueMember property.

This method allows you to set the property to use as the value for the list items.

```csharp

myListControl.ValueMember("ID");

```

### ![](/files/lIX317sDtMTZJBi9oSIx) VirtualScroll\<TListControl>(listControl, value)

Sets the VirtualScroll property of the specified [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md).

| Parameter        | Type                                                                                       | Description                                                                                                   |
| ---------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
| **TListControl** |                                                                                            | The type of the list control, must inherit from [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md). |
| **listControl**  | [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md) | The list control for which to set the VirtualScroll property.                                                 |
| **value**        | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                            | A boolean indicating whether virtual scrolling is enabled for the list control.                               |

**Returns:** [TListControl](/api/wisej.web.markup/extensions/wisej.web.markup.listcontrolextensions.md). The modified list control with the updated VirtualScroll property.

This method allows you to enable or disable virtual scrolling for the list control.

```csharp

myListControl.VirtualScroll(true);

```


---

# 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.markup/extensions/wisej.web.markup.listcontrolextensions.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.
