How to add event to the band from program.

mohanarajmohanaraj 600001
edited 8:36AM in FastReport .NET
Dear Alex,


How add the event to the summary band from the program (ASP.NET). This summary band was also added from the program.

I want to add this event to my summary band

ReportSummary1_BeforePrint(object sender, EventArgs e)

How i add events?

Thanks in advance.

Comments

  • edited November 2009
    You have two options:

    1) band.BeforePrint += new EventHandler(your_method);
    where your_method is defined in your code.

    2) add the code to the report Script:
    (I've skipped line endings in the script text)

    report.ScriptText =
    "using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Drawing;
    using System.Data;
    using FastReport;
    using FastReport.Data;
    using FastReport.Dialog;
    using FastReport.Barcode;
    using FastReport.Table;
    using FastReport.Utils;

    namespace FastReport
    {
    public class ReportScript
    {

    private void ReportSummary1_BeforePrint(object sender, EventArgs e)
    {
    // your code here
    }
    }
    }";
    band.BeforePrintEvent = "ReportSummary1_BeforePrint";
  • mohanarajmohanaraj 600001
    edited 8:36AM
    AlexTZ wrote: »
    You have two options:

    1) band.BeforePrint += new EventHandler(your_method);
    where your_method is defined in your code.

    Dear Alex,

    If i go with First option where can i define the method in asp.net page or in the report script and How?

    Thanks.
  • edited 8:36AM
    Define this method in your Page class.

Leave a Comment