Hello,
I am attempting to pass cached data to a report. The data is cached in memory and retrieved. The report is designed using Report Designer and stored as .trdx. I create a dataobject that retrieves the data from the cache. I want to bind a table to a list of view models which match the described schema identically and contain all fields in the same order same spelling case sensitive. The header item is binding fine to reportitem.dataobject, but I cannot get the table to bind to the underlying List. it is saying that it contains LeadStatus that is not defined. However I have it defined in the XML
I load the report like so.
string
reportsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
"Reports"
);
string
reportName = reportsPath + @
"\LeadsActivity.trdx"
;
System.Xml.XmlReaderSettings settings =
new
System.Xml.XmlReaderSettings();
settings.IgnoreWhitespace =
true
;
//read the .trdx file contents
using
(System.Xml.XmlReader xmlReader = System.Xml.XmlReader.Create(reportName,settings))
{
Telerik.Reporting.XmlSerialization.ReportXmlSerializer xmlSerializer =
new
Telerik.Reporting.XmlSerialization.ReportXmlSerializer();
//deserialize the .trdx report XML contents
Telerik.Reporting.Report report = (Telerik.Reporting.Report) xmlSerializer.Deserialize(xmlReader);
var dataobjs =
new
LeadsActivityDataProvider(cacheKey);
report.DataSource = dataobjs;
string
mimType =
string
.Empty;
string
extension =
string
.Empty;
Encoding encoding =
null
;
// call Render() and retrieve raw array of bytes
// write the pdf file
byte
[] buffer = Telerik.Reporting.Processing.ReportProcessor.Render(
"PDF"
, report,
null
,
out
mimType,
out
extension,
out
encoding);
// create a new file on disk and write the byte array to the file
FileStream fs =
new
FileStream(reportsPath + @
"\TestRpt.pdf"
, FileMode.Create);
fs.Write(buffer, 0, buffer.Length);
fs.Flush();
fs.Close();
}
return
reportsPath + @
"\TestRpt.pdf"
;
[DataObject]
public
class
LeadsActivityDataProvider
{
private
ReportDataCache cache =
new
ReportDataCache();
public
string
TestTitle {
get
;
set
; }
public
List<LeadActivityReportViewModel> TableData {
get
;
set
; }
public
LeadsActivityDataProvider(
string
cacheKey)
{
TestTitle =
"Test Title"
;
TableData = cache.Get<List<LeadActivityReportViewModel>>(cacheKey);
}
}
This element works
<
TextBox
Width
=
"7.9999213218689in"
Height
=
"0.499999980131786in"
Left
=
"0.0000394185371988in"
Top
=
"0in"
Value
=
"= ReportItem.DataObject.TestTitle"
Name
=
"Arial"
>
<
Style
TextAlign
=
"Center"
>
<
Font
Name
=
"Calibri"
Size
=
"12pt"
Bold
=
"False"
/>
</
Style
>
</
TextBox
>
However this table is giving me an Error
<
Table
Width
=
"7.97916757624932in"
Height
=
"1.21770811465888in"
Left
=
"0.0208326975504557in"
Top
=
"0in"
Name
=
"table2"
>
<
Body
>
<
Cells
>
<
TableCell
RowIndex
=
"3"
ColumnIndex
=
"0"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"1.40624906538in"
Height
=
"0.203993031202274in"
Left
=
"3.3999605178833in"
Top
=
"0.100000063578288in"
Value
=
"=Fields.EventDate"
Format
=
"{0:d}"
Name
=
"textBox33"
>
<
Style
BackgroundColor
=
"White"
/>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"3"
ColumnIndex
=
"1"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"2.25000140574025in"
Height
=
"0.203993031202274in"
Left
=
"3.3999605178833in"
Top
=
"0.100000063578288in"
Value
=
"=Fields.FollowUpDate"
Format
=
"{0:d}"
Name
=
"textBox34"
>
<
Style
BackgroundColor
=
"White"
/>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"1"
ColumnIndex
=
"0"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"1.40624906538in"
Height
=
"0.236979214728681in"
Left
=
"0in"
Top
=
"0in"
Value
=
"=LeadStatus"
Name
=
"textBox37"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
>
<
Font
Bold
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"1"
ColumnIndex
=
"1"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"2.25000140574025in"
Height
=
"0.236979214728681in"
Left
=
"0in"
Top
=
"0in"
Value
=
"=Fields.CustomerName"
Name
=
"textBox38"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
>
<
Font
Bold
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"1"
ColumnIndex
=
"2"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"2.83333372958235in"
Height
=
"0.236979214728681in"
Left
=
"0in"
Top
=
"0in"
Value
=
"=Fields.SourceName"
Name
=
"textBox39"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
>
<
Font
Bold
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"1"
ColumnIndex
=
"3"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"1.48958337554672in"
Height
=
"0.236979214728681in"
Left
=
"0in"
Top
=
"0in"
Value
=
"= Fields.QuoteNumber"
Name
=
"textBox40"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
>
<
Font
Bold
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"2"
ColumnIndex
=
"0"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"1.40624906538in"
Height
=
"0.236979462490679in"
Left
=
"0in"
Top
=
"0in"
Value
=
"Event"
Name
=
"textBox1"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
>
<
Font
Bold
=
"False"
Underline
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"2"
ColumnIndex
=
"1"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"2.25000140574025in"
Height
=
"0.236979462490679in"
Left
=
"0in"
Top
=
"0in"
Value
=
"Follow Up"
Name
=
"textBox11"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
>
<
Font
Bold
=
"False"
Underline
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"2"
ColumnIndex
=
"2"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"2.83333372958235in"
Height
=
"0.236979462490679in"
Left
=
"0in"
Top
=
"0in"
Value
=
"Details"
Name
=
"textBox29"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
>
<
Font
Bold
=
"False"
Underline
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"2"
ColumnIndex
=
"3"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"1.48958337554672in"
Height
=
"0.236979462490679in"
Left
=
"0in"
Top
=
"0in"
Name
=
"textBox31"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
>
<
Font
Bold
=
"False"
Underline
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"4"
ColumnIndex
=
"0"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"1.40624906538in"
Height
=
"0.216145749138395in"
Left
=
"0in"
Top
=
"0in"
Value
=
"=Fields.EventCompletedBy"
Format
=
"{0}"
Name
=
"textBox42"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
/>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"4"
ColumnIndex
=
"1"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"2.25000140574025in"
Height
=
"0.216145749138395in"
Left
=
"0in"
Top
=
"0in"
Value
=
"=Fields.SalesmanName"
Name
=
"textBox43"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
/>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"3"
ColumnIndex
=
"2"
RowSpan
=
"2"
ColumnSpan
=
"2"
>
<
ReportItem
>
<
TextBox
Width
=
"4.32291710512907in"
Height
=
"0.420138771518487in"
Left
=
"0in"
Top
=
"0in"
Value
=
"=Fields.EventDetails"
Name
=
"textBox30"
>
<
Style
BackgroundColor
=
"White"
/>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"0"
ColumnIndex
=
"0"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"1.40624906538in"
Height
=
"0.104166595363224in"
Left
=
"0in"
Top
=
"0in"
Name
=
"textBox8"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
>
<
Font
Bold
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"0"
ColumnIndex
=
"1"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"2.25000140574025in"
Height
=
"0.104166595363224in"
Left
=
"0in"
Top
=
"0in"
Name
=
"textBox9"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
>
<
Font
Bold
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"0"
ColumnIndex
=
"2"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"2.83333372958235in"
Height
=
"0.104166595363224in"
Left
=
"0in"
Top
=
"0in"
Name
=
"textBox10"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
>
<
Font
Bold
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"0"
ColumnIndex
=
"3"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"1.48958337554672in"
Height
=
"0.104166595363224in"
Left
=
"0in"
Top
=
"0in"
Name
=
"textBox12"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
>
<
Font
Bold
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
</
Cells
>
<
Columns
>
<
Column
Width
=
"1.40624906538001in"
/>
<
Column
Width
=
"2.25000140574025in"
/>
<
Column
Width
=
"2.83333372958235in"
/>
<
Column
Width
=
"1.48958337554672in"
/>
</
Columns
>
<
Rows
>
<
Row
Height
=
"0.104166603885721in"
/>
<
Row
Height
=
"0.236979028603148in"
/>
<
Row
Height
=
"0.236979518525301in"
/>
<
Row
Height
=
"0.203992951132829in"
/>
<
Row
Height
=
"0.216145760447272in"
/>
</
Rows
>
</
Body
>
<
Corner
/>
<
Style
>
<
Font
Name
=
"Calibri"
Size
=
"11pt"
/>
</
Style
>
<
RowGroups
>
<
TableGroup
Name
=
"leadStatus1"
>
<
ChildGroups
>
<
TableGroup
Name
=
"leadStatus"
>
<
ChildGroups
>
<
TableGroup
Name
=
"group5"
/>
<
TableGroup
Name
=
"group11"
/>
<
TableGroup
Name
=
"group18"
/>
<
TableGroup
Name
=
"detailTableGroup1"
>
<
ChildGroups
>
<
TableGroup
Name
=
"group19"
/>
<
TableGroup
Name
=
"group20"
/>
</
ChildGroups
>
<
Groupings
>
<
Grouping
/>
</
Groupings
>
</
TableGroup
>
</
ChildGroups
>
<
Groupings
>
<
Grouping
Expression
=
"=Fields.CustomerName"
/>
</
Groupings
>
<
Sortings
>
<
Sorting
Expression
=
"=Fields.CustomerName"
Direction
=
"Asc"
/>
</
Sortings
>
</
TableGroup
>
</
ChildGroups
>
<
Groupings
>
<
Grouping
Expression
=
"=Fields.LeadStatus"
/>
</
Groupings
>
<
Sortings
>
<
Sorting
Expression
=
"=Fields.LeadStatus"
Direction
=
"Asc"
/>
</
Sortings
>
</
TableGroup
>
</
RowGroups
>
<
ColumnGroups
>
<
TableGroup
Name
=
"tableGroup3"
>
<
ReportItem
>
<
TextBox
Width
=
"1.40624906538in"
Height
=
"0.194444241854954in"
Left
=
"0in"
Top
=
"0in"
Value
=
"Status"
Name
=
"textBox3"
StyleName
=
""
>
<
Style
>
<
BorderStyle
Bottom
=
"Solid"
/>
<
BorderColor
Bottom
=
"Black"
/>
<
BorderWidth
Bottom
=
"1pt"
/>
<
Font
Name
=
"Calibri"
Size
=
"11pt"
Bold
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
<
ChildGroups
>
<
TableGroup
Name
=
"group1"
>
<
ReportItem
>
<
TextBox
Width
=
"1.40624906538in"
Height
=
"0.0250000016262168in"
Left
=
"0in"
Top
=
"0in"
Name
=
"textBox2"
StyleName
=
""
>
<
Style
BackgroundColor
=
"Black"
/>
</
TextBox
>
</
ReportItem
>
<
ChildGroups
>
<
TableGroup
Name
=
"group14"
/>
</
ChildGroups
>
</
TableGroup
>
</
ChildGroups
>
</
TableGroup
>
<
TableGroup
Name
=
"tableGroup4"
>
<
ReportItem
>
<
TextBox
Width
=
"2.25000140574025in"
Height
=
"0.194444241854954in"
Left
=
"0in"
Top
=
"0in"
Value
=
"Customer"
Name
=
"textBox6"
StyleName
=
""
>
<
Style
>
<
BorderStyle
Bottom
=
"Solid"
/>
<
BorderColor
Bottom
=
"Black"
/>
<
BorderWidth
Bottom
=
"1pt"
/>
<
Font
Name
=
"Calibri"
Size
=
"11pt"
Bold
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
<
ChildGroups
>
<
TableGroup
Name
=
"group2"
>
<
ReportItem
>
<
TextBox
Width
=
"2.25000140574025in"
Height
=
"0.0250000016262168in"
Left
=
"0in"
Top
=
"0in"
Name
=
"textBox4"
StyleName
=
""
>
<
Style
BackgroundColor
=
"Black"
/>
</
TextBox
>
</
ReportItem
>
<
ChildGroups
>
<
TableGroup
Name
=
"group15"
/>
</
ChildGroups
>
</
TableGroup
>
</
ChildGroups
>
</
TableGroup
>
<
TableGroup
Name
=
"tableGroup5"
>
<
ReportItem
>
<
TextBox
Width
=
"2.83333372958235in"
Height
=
"0.194444241854954in"
Left
=
"0in"
Top
=
"0in"
Value
=
"Source of Lead"
Name
=
"textBox36"
StyleName
=
""
>
<
Style
>
<
BorderStyle
Bottom
=
"Solid"
/>
<
BorderColor
Bottom
=
"Black"
/>
<
BorderWidth
Bottom
=
"1pt"
/>
<
Font
Name
=
"Calibri"
Size
=
"11pt"
Bold
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
<
ChildGroups
>
<
TableGroup
Name
=
"group3"
>
<
ReportItem
>
<
TextBox
Width
=
"2.83333372958235in"
Height
=
"0.0250000016262168in"
Left
=
"0in"
Top
=
"0in"
Name
=
"textBox5"
StyleName
=
""
>
<
Style
BackgroundColor
=
"Black"
/>
</
TextBox
>
</
ReportItem
>
<
ChildGroups
>
<
TableGroup
Name
=
"group16"
/>
</
ChildGroups
>
</
TableGroup
>
</
ChildGroups
>
</
TableGroup
>
<
TableGroup
Name
=
"group"
>
<
ReportItem
>
<
TextBox
Width
=
"1.48958337554672in"
Height
=
"0.194444241854954in"
Left
=
"0in"
Top
=
"0in"
Value
=
"Quote #"
Name
=
"textBox41"
StyleName
=
""
>
<
Style
>
<
BorderStyle
Bottom
=
"Solid"
/>
<
BorderColor
Bottom
=
"Black"
/>
<
BorderWidth
Bottom
=
"1pt"
/>
<
Font
Name
=
"Calibri"
Size
=
"11pt"
Bold
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
<
ChildGroups
>
<
TableGroup
Name
=
"group4"
>
<
ReportItem
>
<
TextBox
Width
=
"1.48958337554672in"
Height
=
"0.0250000016262168in"
Left
=
"0in"
Top
=
"0in"
Name
=
"textBox7"
StyleName
=
""
>
<
Style
BackgroundColor
=
"Black"
/>
</
TextBox
>
</
ReportItem
>
<
ChildGroups
>
<
TableGroup
Name
=
"group17"
/>
</
ChildGroups
>
</
TableGroup
>
</
ChildGroups
>
</
TableGroup
>
</
ColumnGroups
>
<
Bindings
>
<
Binding
Path
=
"DataSource"
Expression
=
"ReportItem.DataObject.TableData"
/>
</
Bindings
>
</
Table
>
Here is the view model
public
class
LeadActivityReportViewModel : ViewModelBaseActive {
public
string
CacheID {
get
;
set
;}
public
string
CustomerName {
get
;
set
;}
public
string
EventCompletedBy {
get
;
set
;}
public
DateTime EventDate {
get
;
set
;}
public
string
EventDetails {
get
;
set
;}
public
DateTime FollowUpDate {
get
;
set
;}
public
string
LeadStatus {
get
;
set
;}
public
string
QuoteNumber {
get
;
set
;}
public
int
Row {
get
;
set
;}
public
string
SalesmanName {
get
;
set
;}
public
string
SourceName {
get
;
set
;}
}