Skip to main content

ASPxClientListBox.SetItemTextCellHtml(itemIndex, textCellIndex, html) Method

Defines the HTML content for the specified list box item’s text cell.

Declaration

SetItemTextCellHtml(
    itemIndex: number,
    textCellIndex: number,
    html: string
): void

Parameters

Name Type Description
itemIndex number

The item’s index.

textCellIndex number

The index of the item’s text cell.

html string

A string value that is the HTML code defining the content of the list box item.

Remarks

Use the SetItemTextCellHtml method on the client side to dynamically provide a list box item’s text cell with the specified HTML content.

Example

The following example illustrates how to specify the HTML content for a list box item’s text cell using the ASPxClientListBox.SetItemTextCellHtml method.

<dx:ASPxListBox ID="ASPxListBox1" ClientInstanceName="clientListBox" runat="server" DataSourceID="SqlDataSource1">
    <Columns>
        <dx:ListBoxColumn FieldName="ContactName" />
        <dx:ListBoxColumn FieldName="CompanyName" />
        <dx:ListBoxColumn FieldName="Phone" />
    </Columns>
    <ClientSideEvents Init="function(s, e) {
        for (i = 0 ; i < clientListBox.GetItemCount(); i++){
            clientListBox.SetItemTextCellHtml(i, 1, '<i>' + clientListBox.GetItem(i).GetColumnText(1) + '</i>');
            clientListBox.SetItemTextCellHtml(i, 2, '<b>' + clientListBox.GetItem(i).GetColumnText(2) + '</b>');
        }
}" />
</dx:ASPxListBox>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=|DataDirectory|\nwind.mdb;Persist Security Info=True" ProviderName="System.Data.OleDb" 
SelectCommand="SELECT [CompanyName], [ContactName], [ContactTitle], [Address], [City], [Region], [Country], [Phone] FROM [Customers]"></asp:SqlDataSource>
See Also