Skip to main content

How to: Show a Complex Property Value in DataItemTemplate of a Column

  • 3 minutes to read

The following example demonstrates how to show a complex property value in DataItemTemplate of a column that uses BindingExpressions.

<dx:aspxcardview ID="ASPxCardView1" AutoGenerateColumns="False"  EnableCardsCache="False" runat="server" DataSourceID="ObjectDataSource1" KeyFieldName="Id">
    <SettingsBehavior AllowFocusedCard="True" />
        <dx:CardViewTextColumn FieldName="Id" VisibleIndex="0" Width="10%">
        <dx:CardViewTextColumn FieldName="Name" VisibleIndex="1" Width="30%">
        <dx:CardViewTextColumn Caption="Street" FieldName="Address" VisibleIndex="2" Width="30%">
                <dx:ASPxTextBox ID="ASPxTextBox1" runat="server" Text='<%# Eval("Address.Street") %>' Width="100%"></dx:ASPxTextBox>
        <dx:CardViewTextColumn Caption="City" FieldName="Address" VisibleIndex="3" Width="33%">
                <dx:ASPxTextBox ID="ASPxTextBox2" runat="server" Text='<%# Eval("Address.City") %>' Width="100%"></dx:ASPxTextBox>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="SelectData" TypeName="Person">
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;

public class Person {
    private int id;
    private string name;
    private Address address;

    public Person() {

    public Person(int id, string name, Address address) { = id; = name;
        this.address = address;

    public int Id { get{ return id; } }
    public string Name { get{ return name; } }
    public Address Address { get{ return address; } }

    public List<Person> SelectData() {
        List<Person> persons = new List<Person>();
        persons.Add(new Person(0, "John", new Address("Home Lane", "Homesville")));
        persons.Add(new Person(1, "Henry", new Address("436 1st Ave", "Cleveland")));
        return persons;

public class Address {
    string street;
    string city;
    public Address(string street, string city) {
        this.street = street; = city;

    public string Street { get { return street; } }
    public string City { get { return city; } }}