HI,
I want to share my experience with binding an IEnumerable<String> to a report.
Normally, you bind a collection of complex objects with public properties:
Then, in a report's textbox, you specify this expression to load the data from MyType object:
But what if you want to just bind a list of strings without creating redundant wrapper types?
You can't just set "= Fields" expression to a textbox, it will produce "Incorrect use of Fields" exception. But you can set following expression and it will work (RawData is of type Object, so I guess it calls ToString() method internally):
I want to share my experience with binding an IEnumerable<String> to a report.
Normally, you bind a collection of complex objects with public properties:
public sealed class MyType{ public String FirstName { get; set; } public String LastName { get; set; }}report.DataSource = new List<MyType>();Then, in a report's textbox, you specify this expression to load the data from MyType object:
= Fields.FirstName + " " + Fields.LastNameBut what if you want to just bind a list of strings without creating redundant wrapper types?
report.DataSource = new List<String>();You can't just set "= Fields" expression to a textbox, it will produce "Incorrect use of Fields" exception. But you can set following expression and it will work (RawData is of type Object, so I guess it calls ToString() method internally):
= ReportItem.DataObject.RawData