[]
        
(Showing Draft Content)

GrapeCity.ActiveReports.SectionReport.AddNamedItem

AddNamedItem Method

AddNamedItem(string, object)

Adds the object to the global namespace of the script.

Declaration
public void AddNamedItem(string objectName, object objectReference)
Parameters
Type Name Description
string objectName

A string value representing the name of the object to be used in the script.

object objectReference

An object value that references the object to be used in the script.

Remarks

This method allows scripts to become aware of custom classes contained within a project. Once an item has been added, the script can use the objectName string to reference the object and the functions contained within the class.

Examples
var sectionReport = new GrapeCity.ActiveReports.SectionReport();
sectionReport.Document.Printer.PrinterName = String.Empty;
sectionReport.CompatibilityMode = GrapeCity.ActiveReports.Document.CompatibilityModes.CrossPlatform;
var ctl = new GrapeCity.ActiveReports.SectionReportModel.TextBox{Name = "text1"};
sectionReport.Sections.Add(new GrapeCity.ActiveReports.SectionReportModel.Detail{Name = "Details"});
sectionReport.Sections[0].Controls.Add(ctl);
sectionReport.ScriptLanguage = "C#";
sectionReport.Script = @"public void Detail_Format(){text1.Text = text1Value;}";
this.AddNamedItem("text1Value", "Hello World!");
Exceptions
Type Condition
ArgumentNullException

Thrown if the objectName or objectReference is null.