ASPxClientComboBox.SetItemTextCellHtml(itemIndex, textCellIndex, html) Method

Defines the HTML content for the specified combo box item's text cell.

Declaration

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

Parameters

Name Type Description
itemIndex number

An integer value specifying the zero-based index of the item.

textCellIndex number

An integer value specifying the zero-based index of the item's text cell.

html string

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

Remarks

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

Examples

The following example illustrates how to specify the HTML content for a combo box item's text cell using the ASPxClientComboBox.SetItemTextCellHtml method.

<dx:ASPxComboBox ID="ASPxComboBox1" runat="server" ClientInstanceName="clientComboBox" 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 < clientComboBox.GetItemCount(); i++){
            clientComboBox.SetItemTextCellHtml(i, 1, '<i>' + clientComboBox.GetItem(i).GetColumnText(1) + '</i>');
            clientComboBox.SetItemTextCellHtml(i, 2, '<b>' + clientComboBox.GetItem(i).GetColumnText(2) + '</b>');
        }
    }" />        
</dx:ASPxComboBox> 
<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