protected void btnViewReport_OnClick(object sender, EventArgs e) { if (Page.IsValid) { try { DateTime?selecteddate1 = null; DateTime?selecteddate2 = null; if (!string.IsNullOrEmpty(this.txtCheckin.Value) && !string.IsNullOrEmpty(this.txtCheckout.Value)) { selecteddate1 = Convert.ToDateTime(this.txtCheckin.Value); selecteddate2 = Convert.ToDateTime(this.txtCheckout.Value); } this.rvSalesReport.ShowToolBar = true; this.rvSalesReport.ShowRefreshButton = false; //this.rvSalesReport.ShowExportControls = false; this.rvSalesReport.SizeToReportContent = true; this.rvSalesReport.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; this.rvSalesReport.LocalReport.ReportPath = Server.MapPath("~/Reports/Report2.rdl"); this.rvSalesReport.Visible = true; ReportDataSource dataSource = new ReportDataSource("DataSet1", OrderBO.GetDetailReportForDistributorForGivenDateRange(selecteddate1, selecteddate2, int.Parse(this.ddlDistributor.SelectedItem.Value))); this.rvSalesReport.LocalReport.DataSources.Clear(); this.rvSalesReport.LocalReport.DataSources.Add(dataSource); } catch (Exception ex) { } } this.validationSummary.Visible = !Page.IsValid; }