Skip to main content
Tab

ASPxAutoCompleteBoxBase.ItemRowPrepared Event

Enables you to change individual rows settings.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.2.dll

Declaration

public event EventHandler<ListBoxItemRowPreparedEventArgs> ItemRowPrepared

Event Data

The ItemRowPrepared event's data class is ListBoxItemRowPreparedEventArgs. The following properties provide information specific to this event:

Property Description
Item Gets an item object related to the event.
Row Gets the processed row.

Remarks

Use the ItemRowPrepared event to change individual row style settings (CssClass, Tooltip, control styles). The ItemRowPrepared event is raised for each row within the editor’s list.

The processed row is identified by the ListBoxItemRowPreparedEventArgs.Row property.

To set an attribute to a processed item, use the client SetItemAttribute(index, attributeName, attributeValue) method.

function OnClick(s, e) {
    comboBox.SetItemAttribute(5, "your_attribute_name", "attribute_value");
}

Example

The following example illustrates how to customize the appearance of combo box items.

ASPxComboBox-ItemAppearanceCustomization

string GetItemTooltip(ListEditItem item) {
    return string.Format("Country: {0}\r\nCity: {1} \r\nAddress: {2}",
        item.GetFieldValue("Country"), item.GetFieldValue("City"), item.GetFieldValue("Address"));
}
protected void customersComboBox_ItemTextCellPrepared(object sender, ListBoxItemTextCellPreparedEventArgs e) { 
    if(e.Column.FieldName == "ContactName") {
        string contactTitle = e.Item.GetFieldValue("ContactTitle").ToString();
        if(contactTitle == "Owner") {
            e.TextCell.CssClass += " owner";
            e.TextCell.ToolTip = "Owner";
        }
    }
    if(e.Column.FieldName == "Phone")
        e.TextCell.CssClass += " phone";
}
protected void customersComboBox_ItemRowPrepared(object sender, ListBoxItemRowPreparedEventArgs e) {
    e.Row.ToolTip = GetItemTooltip(e.Item);
}
See Also