Reportviewer control problem in Win forms -Solution required Urgently

Posted by Shashi under C# on 10/13/2009 | Views : 5009 | Status : [Member] | Replies : 6
Hi friends
I am developing my desktop application using .net framework and c#.I am using Microsoft reporting services and in win forms I am using report viewer control to display the report.

I am able to see the report viewer control but the report is not generating.Below is my code.Please check it and help me to rectify the problem.

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["customerreport"].DefaultView;
rpt.Name = "Customerscontactinfo_sp_showcontactlistofcustomers";
rpt.Value = this.bindingSource1;
//reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("Customerscontactinfo_sp_showcontactlistofcustomers",bindingSource1));
reportViewer1.LocalReport.DataSources.Add(rpt);
reportViewer1.DocumentMapCollapsed = true;
reportViewer1.LocalReport.Refresh();
//MessageBox.Show(ds.Tables[0].Rows.Count.ToString());
}




Responses

Posted by: Danishgr8 on: 1/27/2010 [Member] Starter

Up
0
Down
Click on the Report Viewer Control Arrow on top Right, Check its Datasources, there should be a DataSource binding with your data otherwise no data will be output.

Shashi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 10/13/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Do you get some sort of Error ?

Thank you for posting at Dotnetfunda
[Administrator]

Shashi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shashi on: 10/13/2009 [Member] Starter

Up
0
Down
No I am not getting any error.But the Report is not generating and I am able to see the report viewer control only.

Shashi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 10/14/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Check if the dataset has data before you bind it to the BindingSource

if(ds.Tables["customerreport"].Rows.Count)

{
..then Bind
}
else
{
...There are no Records
}


Thank you for posting at DotnetFunda

Vuyiswa Maseko


Thank you for posting at Dotnetfunda
[Administrator]

Shashi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shashi on: 10/14/2009 [Member] Starter

Up
0
Down
Dataset has data ..It is showing rows count as 2.

Shashi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bubbly on: 10/30/2009 [Member] Bronze

Up
0
Down
Hello,

Did you bind the report viewer control to rdlc report?

++
Thanks & Regards,
Deepika

Shashi, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response