Last post Dec 19, 2013 04:16 AM by SamJsr
Dec 12, 2013 01:44 AM|softech.employee|LINK
HI, i am developing an application using ASP.NET MVC4 .
i want to develop a report (RDLC) using my own classes or objects rather dataset or database approaches.
this is not related to SQL Server nor mysql. i want to use my own types as a datasource.
kindly guide. thanks
Dec 19, 2013 04:16 AM|SamJsr|LINK
Yes, it is possible to do it. You can use simple classses and objects to create RDLC reports.
You can also simply display the value of variables to your RDLC report without using DataSet
or DataTable. You can do it by passing the values as parameters. Though it is not convenient but
if you really want to do it , it can be done.
Here is a small example:
I have declared three variables in my Page_Init event and I will pass the values of these
variables to the Report as Parameters.
public void Page_Init(object sender, EventArgs e)
int id = 1;
string name = "SAM";
string year = "2013";
Microsoft.Reporting.WebForms.ReportParameter param = new Microsoft.Reporting.WebForms.ReportParameter;
param = new Microsoft.Reporting.WebForms.ReportParameter("ID", id.ToString());
param = new Microsoft.Reporting.WebForms.ReportParameter("Name", name);
param = new Microsoft.Reporting.WebForms.ReportParameter("Year", year);
Now, add a RDLC report to your project and then add a ReportViewer control.
Go to the source and set ReportPath value of the LocalReport.
ReportPath="[name of the rdlc report].rdlc"
Finally ,edit the RDLC report to create three Parameters
Drag and Drop the Parameters from Report Data window to the Report.
It works fine. You can get the idea and add mode customization for your code.
Hope it works!