I have a class as
public class reportClass
{
public string OrderId { get; set; }
public string awbno { get; set; }
public List Product { get; set; }
}
how to create rdlc report using mvc 4
report should be generate like
OID001 200156 Bag
Mobile
Thanks

Amira BedhiafiRank #601 · 4K reputationPosted Mar 23, 2025, 6:04 PM EDT
RDLC does not support nested lists directly, so you'll need to flatten the data.
Create a flattened model:
public class ReportItem { public string OrderId { get; set; } public string AwbNo { get; set; } public string Product { get; set; } }Then flatten your data like this:
List reportData = GetReportData(); // however you load it List flattenedList = new List(); foreach (var order in reportData) { foreach (var product in order.Product) { flattenedList.Add(new ReportItem { OrderId = order.OrderId, AwbNo = order.awbno, Product = product }); } }Right-click your project > Add > New Item > Report (.rdlc)
Design the report:
Drag a Table control into the report.
Set fields:
OrderId,AwbNo,ProductUse grouping on
OrderIdif needed.Since MVC doesn’t support RDLC directly, you can either host a WebForms page for rendering or generate PDF using LocalReport