ComponentOne AutoComplete for ASP.NET Web Forms
C1.C1Report.4 Assembly / C1.C1Report Namespace / C1Report Class / AddScriptObject Method / AddScriptObject(String,Object) Method
Name of the new object (case-insensitive).
Value of the new object.
Example

In This Topic
    AddScriptObject(String,Object) Method
    In This Topic
    Adds an object to the report's script context.
    Syntax
    'Declaration
     
    Public Overloads Sub AddScriptObject( _
       ByVal name As System.String, _
       ByVal value As System.Object _
    ) 
    public void AddScriptObject( 
       System.string name,
       System.object value
    )

    Parameters

    name
    Name of the new object (case-insensitive).
    value
    Value of the new object.
    Remarks

    This method allows you to add custom objects to the context of the C1Report script interpreter.

    The script interpreter context is cleared whenever a report starts rendering, so this method should always be called from the StartReport event handler.

    Example

    The code below uses the StartReport event to add a variable called "mainForm" to the script context. It then attaches some script to the report's OnOpen event to show the caption of the form when the report starts rendering.

    private void _c1r_StartReport(object sender, System.EventArgs e)
    {
        _c1r.AddScriptObject("mainForm", this);
    }
    private void button1_Click(object sender, System.EventArgs e)
    {
        _c1r.OnOpen = "msgbox(mainForm.Text)";
        _c1r.Render();
    }
    See Also