Report viewer control problem in Windows forms
-
Hi friends I am developing my project in .net framework2.0 and c#.I am using microsoft reporting services and created an rdlc file.I am using reportviewer control to load and display the report. But I am not able to get the report and i am not getting any error. Below is my code. private void BindCustomersreport() { ds = new DataSet(); RBLL = new ReportBLL(); ds = RBLL.ShowCustomersReport(RBLL); if (ds.Tables[0].Rows.Count != 0) { reportViewer1.Visible = true; reportViewer1.ProcessingMode=Microsoft.Reporting.WinForms.ProcessingMode.Local; reportViewer1.LocalReport.ReportEmbeddedResource = @"C:\Inetpub\wwwroot\Tirumala Gruha Nirman\Tirumala Gruha Nirman\CustomersContactList.rdlc"; reportViewer1.LocalReport.DataSources.Clear(); bindingSource1.DataSource = ds.Tables[0].DefaultView; rpt.Name = "Customerscontactinfo_sp_showcontactlistofcustomers"; reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("Customerscontactinfo_sp_showcontactlistofcustomers",bindingSource1)); // reportViewer1.LocalReport.DataSources.Add(rpt); reportViewer1.DocumentMapCollapsed = true; reportViewer1.LocalReport.Refresh(); } else { reportViewer1.Visible = false; } } Please suggest me my mistake... With Regards Shashi.
-
Hi friends I am developing my project in .net framework2.0 and c#.I am using microsoft reporting services and created an rdlc file.I am using reportviewer control to load and display the report. But I am not able to get the report and i am not getting any error. Below is my code. private void BindCustomersreport() { ds = new DataSet(); RBLL = new ReportBLL(); ds = RBLL.ShowCustomersReport(RBLL); if (ds.Tables[0].Rows.Count != 0) { reportViewer1.Visible = true; reportViewer1.ProcessingMode=Microsoft.Reporting.WinForms.ProcessingMode.Local; reportViewer1.LocalReport.ReportEmbeddedResource = @"C:\Inetpub\wwwroot\Tirumala Gruha Nirman\Tirumala Gruha Nirman\CustomersContactList.rdlc"; reportViewer1.LocalReport.DataSources.Clear(); bindingSource1.DataSource = ds.Tables[0].DefaultView; rpt.Name = "Customerscontactinfo_sp_showcontactlistofcustomers"; reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("Customerscontactinfo_sp_showcontactlistofcustomers",bindingSource1)); // reportViewer1.LocalReport.DataSources.Add(rpt); reportViewer1.DocumentMapCollapsed = true; reportViewer1.LocalReport.Refresh(); } else { reportViewer1.Visible = false; } } Please suggest me my mistake... With Regards Shashi.
Have you stepped through your code to see if your
if
condition is false, therefore running yourreportViewer1.Visible = false;
line? In other words, doesds.Tables[0].Rows.Count == 0
?Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
Have you stepped through your code to see if your
if
condition is false, therefore running yourreportViewer1.Visible = false;
line? In other words, doesds.Tables[0].Rows.Count == 0
?Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
Hi Henry I am getting data as ds.Tables[0].rows.count!=0 and reportviewer1 is also set to true.I am able to see the report control but not the data in the win form. I hope data is not binding to the report or report is not loading..
-
Hi Henry I am getting data as ds.Tables[0].rows.count!=0 and reportviewer1 is also set to true.I am able to see the report control but not the data in the win form. I hope data is not binding to the report or report is not loading..
In that case, I'm stumped. Sorry! :(
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
Hi friends I am developing my project in .net framework2.0 and c#.I am using microsoft reporting services and created an rdlc file.I am using reportviewer control to load and display the report. But I am not able to get the report and i am not getting any error. Below is my code. private void BindCustomersreport() { ds = new DataSet(); RBLL = new ReportBLL(); ds = RBLL.ShowCustomersReport(RBLL); if (ds.Tables[0].Rows.Count != 0) { reportViewer1.Visible = true; reportViewer1.ProcessingMode=Microsoft.Reporting.WinForms.ProcessingMode.Local; reportViewer1.LocalReport.ReportEmbeddedResource = @"C:\Inetpub\wwwroot\Tirumala Gruha Nirman\Tirumala Gruha Nirman\CustomersContactList.rdlc"; reportViewer1.LocalReport.DataSources.Clear(); bindingSource1.DataSource = ds.Tables[0].DefaultView; rpt.Name = "Customerscontactinfo_sp_showcontactlistofcustomers"; reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("Customerscontactinfo_sp_showcontactlistofcustomers",bindingSource1)); // reportViewer1.LocalReport.DataSources.Add(rpt); reportViewer1.DocumentMapCollapsed = true; reportViewer1.LocalReport.Refresh(); } else { reportViewer1.Visible = false; } } Please suggest me my mistake... With Regards Shashi.
Hi, Along the lines of what Henry suggested, is there data in ds.Tables[0].DefaultView (You said there are rows in the dataset, but how about the default view?) Also, looking at what I've done when using the report viewer, I've also set the LocalReport.ReportPath to the path of the .rdlc file, as well as using the ReportEmbeddedResource. I'm not sure it's necessary, but maybe you can try it