Saving the 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 CMSReporting\DisplayReport.ascx user control with ID set to displayReportControl. The code behind will look like this:




using System.Data;


protected void Page_Load(object sender, EventArgs e)



        // Create a new data table with parameters

        DataTable dtp = new DataTable();



        object[] parameters = new object[1];

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




        // Disable loading parameters from basic form 

        displayReportControl.LoadFormParameters = false;


        // Choose a report to save by code name

        displayReportControl.ReportName = "RecentlyModifiedDocuments";


        // Set custom parameters

        displayReportControl.ReportParameters = dtp.Rows[0];


        // Reload data with new parameters



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

        // SavedReportID of the successfully saved report 




// This override must be added if the report contains a table to avoid getting the "...must be placed inside a 

// form tag with runat=server" error

public override void VerifyRenderingInServerForm(Control control)





Page url: