Skip to main content

How to: Bind the ASPxCardView to Data Created at Runtime (DataTable)

The following example binds the ASPxCardView to data created at runtime.

    protected void Page_Load(object sender, EventArgs e) {
        DataTable dt = new DataTable();
        dt.Columns.Add("ID", typeof(int));
        dt.Columns.Add("Data", typeof(string));
        for (int i = 0; i < 50; i++)            
            dt.Rows.Add(new object[] { i, "Row " + i.ToString() });
        ASPxCardView1.DataSource = dt;
        ASPxCardView1.KeyFieldName = "ID";