How to add event to the band from program.

mohanarajmohanaraj 600001
edited 8:44AM 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:44AM
    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:44AM
    Define this method in your Page class.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.