Back to Devexpress

ASPxAutoCompleteBoxBase.ItemTemplate Property

aspnet-devexpress-dot-web-dot-aspxautocompleteboxbase-0a664080.md

latest3.3 KB
Original Source

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.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue(null)]
public virtual ITemplate ItemTemplate { get; set; }
vb
<DefaultValue(Nothing)>
Public Overridable Property ItemTemplate As ITemplate

Property Value

TypeDefaultDescription
ITemplatenull

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

aspx
<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">
                        " />
                    </div>
                </td>
                <td class="name"><%# Eval("Name") %></td>
            </tr>
            <tr>
                <td class="description">
                    <div class="contactInfo">
                        <%# Eval("Address") %>

                        <%# Eval("Phone") %>
                    </div>
                    <%# Eval("Email") %>
                </td>
            </tr>
        </table>
    </ItemTemplate>
    <ItemStyle>
        <SelectedStyle CssClass="selectedItem" />
        <HoverStyle CssClass="hoveredItem" />
    </ItemStyle>
</dx:ASPxComboBox>

See Also

ASPxAutoCompleteBoxBase Class

ASPxAutoCompleteBoxBase Members

DevExpress.Web Namespace