Click here to Skip to main content
15,896,207 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Im using Linq and Reportviewer Im trying to bind it so that I can view the results of whats already in my database for id 8 ? not familiar with the syntax for reportviewer



protected void _subRebind(string user)
{

rpt_report.ProcessingMode = ProcessingMode.Local;
rpt_report.Reset();
rpt_report.LocalReport.Dispose();
rpt_report.LocalReport.DataSources.Clear();
ReportDataSource LabResults = new ReportDataSource();
LabResults.Name = "LabResults";
DataTable dt = new DataTable();
LabResults.Value = dt;
rpt_report.LocalReport.ReportPath = "Report1.rdlc";
rpt_report.LocalReport.DataSources["LabResults"].Value = objLab.getLabsByID(8);
rpt_report.DataBind();
rpt_report.LocalReport.Refresh();


}


XML
public IQueryable<lab> getLabsByID(int _id)
{
    labDataContext objLAB = new labDataContext();

    var allLabs = objLAB.labs.Where(x => x.Id == _id).Select(x => x);

    return allLabs;
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900