Skip to main content
Tab

ASPxAutoCompleteBoxBase.ItemTemplate Property

Specifies a common template used for displaying the content of all items in the combo box and token box.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v23.2.dll

NuGet Package: DevExpress.Web

Declaration

[DefaultValue(null)]
public virtual ITemplate ItemTemplate { get; set; }

Property Value

Type Default Description
ITemplate null

An object that contains the item template.

Remarks

Use the ItemTemplate property to define a common content for all items in the combo box or token box controls. This template replaces the content of each item in the editor - in particular, the item’s text.

The style settings defined for the items using the specific properties (such as the ASPxAutoCompleteBoxBase.ItemStyle property) are still in effect for the items whose contents are specified by using the ItemTemplate property.

Once a template defined by the ItemTemplate property is created in a control, it is instantiated in a container object of the ListEditItemTemplateContainer type. This container object exposes a set of specific properties to which the template’s child controls can be bound.

Run Demo: Combo Box - Item Template

<dx:ASPxComboBox ID="ComboBox" ClientInstanceName="ClientComboBox" EnableCallbackMode="true" 
                 SelectedIndex="0" DropDownRows="4" CallbackPageSize="5" ForceDataBinding="true" 
                 DataSourceID="ContactsDataSource" TextField="Name" Width="285" runat="server">
    <ItemTemplate>
        <table>
            <tr>
                <td rowspan="2">
                    <div class="frame">
                        <img class="photo" alt="photo" src="<%# Page.ResolveUrl(Eval("PhotoUrl").ToString()) %>" />
                    </div>
                </td>
                <td class="name"><%# Eval("Name") %></td>
            </tr>
            <tr>
                <td class="description">
                    <div class="contactInfo">
                        <%# Eval("Address") %><br />
                        <%# Eval("Phone") %>
                    </div>
                    <%# Eval("Email") %>
                </td>
            </tr>
        </table>
    </ItemTemplate>
    <ItemStyle>
        <SelectedStyle CssClass="selectedItem" />
        <HoverStyle CssClass="hoveredItem" />
    </ItemStyle>
</dx:ASPxComboBox>

Combobox Item Template

See Also