public void FillReport() { DashboardReports.AVGCPURpt rpt = new DashboardReports.AVGCPURpt(); string selectedServer = ""; //8/5/2013 NS modified /* * if (this.ServerComboBox.SelectedIndex >= 0) * { * selectedServer = this.ServerComboBox.SelectedItem.Value.ToString(); * } */ if (this.ServerListBox.SelectedItems.Count > 0) { selectedServer = ""; for (int i = 0; i < this.ServerListBox.SelectedItems.Count; i++) { selectedServer += "'" + this.ServerListBox.SelectedItems[i].Text + "'" + ","; } try { selectedServer = selectedServer.Substring(0, selectedServer.Length - 1); } catch { selectedServer = ""; // throw ex; } finally { } } rpt.Parameters["ServerName"].Value = selectedServer; //11/21/2014 NS modified /* * if (StartDateEdit.Text == "") * { * StartDateEdit.Text = DateTime.Today.AddDays(-7).ToShortDateString(); * } * * if (EndDateEdit.Text == "") * { * EndDateEdit.Text = DateTime.Today.ToShortDateString(); * } */ rpt.Parameters["StartDate"].Value = dtPick.FromDate; // StartDateEdit.Text; rpt.Parameters["EndDate"].Value = dtPick.ToDate; //EndDateEdit.Text; //7/14/2014 NS added rpt.Parameters["Threshold"].Value = TCutoffTextBox.Text; rpt.Parameters["ServerType"].Value = srvtype; ReportViewer1.Report = rpt; ReportViewer1.DataBind(); }
protected void ResetButton_Click(object sender, EventArgs e) { //this.ServerComboBox.SelectedIndex = -1; this.ServerListBox.UnselectAll(); DashboardReports.AVGCPURpt rpt = new DashboardReports.AVGCPURpt(); rpt.Parameters["ServerName"].Value = ""; //11/21/2014 NS commented out //rpt.Parameters["StartDate"].Value = DateTime.Now.ToString(); //rpt.Parameters["EndDate"].Value = DateTime.Now.ToString(); //7/14/2014 NS added rpt.Parameters["Threshold"].Value = ""; TCutoffTextBox.Text = ""; //ServerComboBox.Text = ""; //11/21/2014 NS commented out //StartDateEdit.Text = DateTime.Now.ToShortDateString(); //EndDateEdit.Text = DateTime.Now.ToShortDateString(); this.ReportViewer1.Report = rpt; this.ReportViewer1.DataBind(); }