ASPxClientListBox.AddItemCssClass(index, className) Method

Sets the CSS class for a list box item specified by its index.


    index: number,
    className: string
): void


Name Type Description
index number

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

className string

A string value specifying the CSS class name.


Use the AddItemCssClass property to specify the CSS class for the editor’s items on the client side. To implement this task on the server side, use the ASPxListBox.ItemStyle.CssClass property.


The following example illustrates how to specify the CSS class for list box items using the ASPxClientListBox.AddItemCssClass method.


<head runat="server">
    <style type="text/css">
        .class1 {
            color: #006100;
            background-color: #C6EFCE;
            font-weight: bold;

    <form id="form1" runat="server">
        <dx:ASPxListBox ID="ASPxListBox4" runat="server" ClientInstanceName="clientListBox" DataSourceID="SqlDataSource1">
            <ClientSideEvents Init="function(s, e) {
                for (i = 0 ; i < clientListBox.GetItemCount(); i++){
                    clientListBox.AddItemCssClass(i, 'class1');
            }" />
                <dx:ListBoxColumn FieldName="ProductName" />
        <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 [ProductName] FROM [Products]"></asp:SqlDataSource>
See Also