Hi.
Within my details section, I wish some of the reportitem properties to be written out as a table.
The data source is ObjectDataSource (clr object).
If I have a datasource like this
class DetailObject
{
public int Prop1 {get;set;}
public int Prop2 {get;set;}
public int Prop3 {get;set;}
public int Prop4 {get;set;}
public int Prop5 {get;set;}
public int Prop6 {get;set;}
}
I want properties 1,2 and 4 to be written out as a table within the details section and 3 and 5 in another table.
I am faced with the problem that tables need to be bound to collections. Leaving the datasource empty or binding to "= ReportItem" causes the table not to render at all (instead of rendering one and allow direct access to reportitem properties).
The workaround appears to be to create a value object that matches the the table layout and fake a list. Like this:
class Table1Values
{
public int DetailProp1 {get;set;}
public int DetailProp2 {get;set;}
public int DetailProp4 {get;set;}
}
class Table2Values
{
public int DetailProp3 {get;set;}
public int DetailProp5 {get;set;}
}
And then expand my DetailObject class with an Enumerable like this:
class DetailObject
{
// ( all the other stuff)
public IEnumerable Table1Data {
get {
yield return new Table1Values
{ DetailProp1 = Prop1,
DetailProp2 = Prop2,
DetailProp4 = Prop4
};
}};
}
Then it is possible to bind a table datasource to "=Fields.Table1Data" and binding cells to DetailProp1, DetailProp2 and DetailProp4.
Am I missing something obvious, or is this how one should go about creating a table within the details section where the table is a table layout of predetermined individual ReportItem properties?
Within my details section, I wish some of the reportitem properties to be written out as a table.
The data source is ObjectDataSource (clr object).
If I have a datasource like this
class DetailObject
{
public int Prop1 {get;set;}
public int Prop2 {get;set;}
public int Prop3 {get;set;}
public int Prop4 {get;set;}
public int Prop5 {get;set;}
public int Prop6 {get;set;}
}
I want properties 1,2 and 4 to be written out as a table within the details section and 3 and 5 in another table.
I am faced with the problem that tables need to be bound to collections. Leaving the datasource empty or binding to "= ReportItem" causes the table not to render at all (instead of rendering one and allow direct access to reportitem properties).
The workaround appears to be to create a value object that matches the the table layout and fake a list. Like this:
class Table1Values
{
public int DetailProp1 {get;set;}
public int DetailProp2 {get;set;}
public int DetailProp4 {get;set;}
}
class Table2Values
{
public int DetailProp3 {get;set;}
public int DetailProp5 {get;set;}
}
And then expand my DetailObject class with an Enumerable like this:
class DetailObject
{
// ( all the other stuff)
public IEnumerable Table1Data {
get {
yield return new Table1Values
{ DetailProp1 = Prop1,
DetailProp2 = Prop2,
DetailProp4 = Prop4
};
}};
}
Then it is possible to bind a table datasource to "=Fields.Table1Data" and binding cells to DetailProp1, DetailProp2 and DetailProp4.
Am I missing something obvious, or is this how one should go about creating a table within the details section where the table is a table layout of predetermined individual ReportItem properties?