I want to pass an IList to a Report. The code is:
Code: Select all
IList<Product> pros = new List<Product>
{
new Product() { Id = 1, Name = "Gizmo 1", Price = 1.99M },
new Product() { Id = 2, Name = "Gizmo 2", Price = 2.99M },
new Product() { Id = 3, Name = "Gizmo 3", Price = 3.99M }
};
StiReport report = new StiReport();
report.RegData("ProductIEnumerable", pros);
report.Load(@"C:\Projects\Test\Content\Reports\Products.mrt");
return StiMvcViewer.GetReportSnapshotResult(HttpContext, report); // error line
{pros.Id}, {pros.Name} and {pros.Price}
I get an error:
error CS0103: The name 'pros' does not exist in the current context.
I've tried:
{Id}, {Name} and {Price}
{ProductIEnumerable.Id}, {ProductIEnumerable.Name} and {ProductIEnumerable.Price}
Still the same error.
How do I assign a report column to an object's property without data source?