I have been looking for an example of displaying data in objects that have data items in a list. I can display the first level "items" in a table but cannot retrieve the attributeItems data to display.
I want the report to look like this:
Name Attribute Name Attribute Value
XXXX XXXXXXX XXXXXX
XXXXXXX XXXXXX
XXXX XXXXX XXXX
XXXX XXXXXXX
XXXXX XXXXX
I have yet to find any examples using objects or even a decent tutorial on crosstab reports. I have downloaded one project but this is returning a datatable object.
Here is the report code.
I want the report to look like this:
Name Attribute Name Attribute Value
XXXX XXXXXXX XXXXXX
XXXXXXX XXXXXX
XXXX XXXXX XXXX
XXXX XXXXXXX
XXXXX XXXXX
I have yet to find any examples using objects or even a decent tutorial on crosstab reports. I have downloaded one project but this is returning a datatable object.
Here is the report code.
namespace
Reports
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Telerik.Reporting;
using Telerik.Reporting.Drawing;
/// <summary>
/// Summary description for CrossTabReport.
/// </summary>
public partial class CrossTabReport : Telerik.Reporting.Report
{
public CrossTabReport()
{
InitializeComponent();
}
}
[
DataObject]
public class CrossTabReportModel {
[
DataObjectMethod(DataObjectMethodType.Select)]
public CrossTabData getData() {
return new CrossTabData();
}
}
public class CrossTabData {
public CrossTabData() {
title =
"CROSS TAB DATA";
items =
new List<CrossTabItem>() {
new CrossTabItem { itemName = "FRED",
itemAttributes =
new List<ItemAttribute>()
{
new ItemAttribute{ attribName = "HAIR", attribValue= "BROWN"},
new ItemAttribute{ attribName = "EYES", attribValue= "BROWN"},
new ItemAttribute{ attribName = "HEIGHT", attribValue= "5'6"},
new ItemAttribute{ attribName = "WEIGHT", attribValue= "200"}
}
},
new CrossTabItem { itemName = "SAM",
itemAttributes =
new List<ItemAttribute>()
{
new ItemAttribute{ attribName = "HAIR", attribValue= "BLONDE"},
new ItemAttribute{ attribName = "EYES", attribValue= "BLUE"},
new ItemAttribute{ attribName = "HEIGHT", attribValue= "6'0"},
new ItemAttribute{ attribName = "WEIGHT", attribValue= "210"}
}
},
new CrossTabItem { itemName = "CHILLY",
itemAttributes =
new List<ItemAttribute>()
{
new ItemAttribute{ attribName = "HAIR", attribValue= "BROWN"},
new ItemAttribute{ attribName = "EYES", attribValue= "GREEN"},
new ItemAttribute{ attribName = "HEIGHT", attribValue= "5'10"},
new ItemAttribute{ attribName = "WEIGHT", attribValue= "150"}
}
}
};
}
public string title { get; set; }
public List<CrossTabItem> items { get; set; }
}
public class CrossTabItem {
public string itemName { get; set; }
public List<ItemAttribute> itemAttributes { get; set; }
}
public class ItemAttribute {
public string attribName { get; set; }
public string attribValue { get; set; }
}
}
Thanks for any help.