Saving current status of the report

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  

The following sample code shows you how to execute a report and save its status into a saved report. You will need to create an ASCX user control where you place the user control CMSReporting\DisplayReport.ascx with ID set to "displayReportControl". The code behind will look like this:

 

[C#]

 

using System.Data;

 

protected void Page_Load(object sender, EventArgs e)

{

  // Create a new data table with parameters

  DataTable dtp = new DataTable();

   dtp.Columns.Add("ModifiedSince", typeof(DateTime));

 

  object[] parameters = new object[1];

   parameters[0] = new DateTime(2006, 1, 1);

 

   dtp.Rows.Add(parameters);

 

  // Disable loading parameters from basic form

   displayReportControl.LoadFormParameters = false;

 

  // Choose report code name

   displayReportControl.ReportName = "RecentlyModifiedDocuments";

     

  // Set custom parameters

   displayReportControl.ReportParameters = dtp.Rows[0];

     

  // Reload data with new parameters

   displayReportControl.ReloadData(false);

     

  // SaveReport() returns 0 if some problem occured or

  // SavedReportID of the successfully saved report

    displayReportControl.SaveReport();

}

 

protected override void Render(HtmlTextWriter writer)

{

  base.Render(writer);

}

 

Page url: http://devnet.kentico.com/docs/devguide/index.html?saving_current_status_of_the_report.htm