Skip to main content

ASPxClientComboBox.AddItemTextCellCssClass(itemIndex, textCellIndex, className) Method

Sets the CSS class for a combo box item’s text cell specified by its index.

Declaration

AddItemTextCellCssClass(
    itemIndex: number,
    textCellIndex: number,
    className: string
): void

Parameters

Name Type Description
itemIndex number

The item’s index.

textCellIndex number

The zero-based index of the item’s text cell.

className string

A string value specifying the CSS class name.

Remarks

Use the AddItemTextCellCssClass property to specify the CSS class for the item’s text cell of the editor on the client side.

Example

This example illustrates how to customize the appearance of columns in a combo box.

<head runat="server">
    <title></title>
   <style type="text/css">
        .class1 {
            color: #006100;
            background-color: #C6EFCE;
            font-weight: bold;
        }
        .class2 {
            color: brown;
            background-color: azure;
            font-weight: bold;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <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.AddItemTextCellCssClass(i,1, 'class1');
                    clientComboBox.AddItemTextCellCssClass(i,2, 'class2');
                }
            }" />        
        </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>        
    </div>        
    </form>
</body>
See Also