Search code examples
timeactivereportsoutputformatgrapecity

Add just time value in ReportInfo field for active reports?


I'm trying to add time for a report on script section like this

using GrapeCity.ActiveReports;
public string OutputFormat {get; set;}
public void PageHeader_Format()
{
this.ReportInfoTime.OutputFormat = "hh:mm tt";
this.ReportInfoTime.Value = System.DateTime.Today;  
}

But I'm getting this error

'GrapeCity.ActiveReports.SectionReportModel.ReportInfo' does not contain a definition for 'OutputFormat' and no extension method 'OutputFormat' accepting a first argument of type 'GrapeCity.ActiveReports.SectionReportModel.ReportInfo' could be found (are you missing a using directive or an assembly reference?)

any advice.


Solution

  • For changing the output format of "ReportInfo" control to a custom string using Script, you may replace your script code with the following:

    public void PageHeader_Format()
    {
        this.ReportInfo1.FormatString = "{RunDateTime:hh:mm tt}";
    }
    

    *where "ReportInfo1" is the name of your ReportInfo control