Ancy Raju

Ancy Raju

  • NA
  • 20
  • 25.5k

Report Viewer Issuse

Jun 30 2011 5:21 AM
Hi, I have to create report using ReportViewer..
I am having some issues plsssss help...

given below is my is my source code:

namespace Radar.WebApp.Report {
public partial class GenerateReport : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {


if (!IsPostBack) {


generate();
}


}






public void generate() {


string response = string.Empty;
string mimeType = string.Empty;
string encoding = string.Empty;
string extension = string.Empty;
IFormatProvider format = new CultureInfo("en-US");
DateTime fromDate = DateTime.Parse(Request.QueryString["fromDate"].Trim(), format, DateTimeStyles.None);
DateTime toDate = DateTime.Parse(Request.QueryString["toDate"].Trim(), format, DateTimeStyles.None);
int edition = int.Parse(Request.QueryString["edition"].Trim());
int company = int.Parse(Request.QueryString["company"].Trim());
     


DataTable coverageResults = new DataTable();
MediaTrackController controller = new MediaTrackController();


coverageResults = new MediaTrackController().GenerateReportClient(fromDate, toDate, edition, company, int.Parse(Session["Group_id"].ToString())).Tables[0];


ReportDataSource coverageCountSource = new ReportDataSource("ClientReport");
coverageCountSource.Value = coverageResults;








rptViewer.LocalReport.ReportPath = "Report/ReportClient.rdlc";
rptViewer.LocalReport.DataSources.Add(coverageCountSource);


//string dateRange = fromDate.ToString("dd-MMM-yyyy") + " - " + toDate.ToString("dd-MMM-yyyy");
//ReportParameter pDateRange = new ReportParameter("dateRange", dateRange);
//List<ReportParameter> parameters = new List<ReportParameter>();
//parameters.Add(pDateRange);
//rptViewer.LocalReport.SetParameters(parameters);
rptViewer.LocalReport.EnableExternalImages = true;
rptViewer.ProcessingMode = ProcessingMode.Local;
rptViewer.LocalReport.Refresh();
}
}
}



I am getting an error... 

Object reference not set to an instance of an object. 

coverageResults = new MediaTrackController().GenerateReportClient(fromDate, toDate, edition, company, int.Parse(Session["Group_id"].ToString())).Tables[0];
plsss help where am i goin wrong







Answers (2)