Progress® Telerik® Reporting R3 2017

Using Section Events

The various report Section objects expose these events:

EventDescription
ItemDataBindingFires just before the section is bound to data.
ItemDataBoundFires just after the section is bound to data.

In ItemDataBinding and ItemDataBound events use the "sender" argument of the event handler to get a reference to the section object. From the section object you can reference any of the items the section contains, i.e. TextBoxes, PictureBoxes, etc. You can also use the section DataObject property to access the data fields for the section.

Tip Tip

Be aware that the "sender" section object is of type Telerik.Reporting.Processing.ReportItemBase, not the definition item Telerik.Reporting.ReportItemBase.

The example below demonstrates getting a reference to the detail section of the report and finding a specific TextBox within the section. The example also shows retrieving data source column values for the section and using it to alter the TextBox.

The second example demonstrates getting a reference to the detail section of the report, finding all its children and setting a BackgroundColor to them:

Example

private void detail_ItemDataBinding(object sender, EventArgs e)
{
    Telerik.Reporting.Processing.DetailSection section = (sender as Telerik.Reporting.Processing.DetailSection);
    Telerik.Reporting.Processing.TextBox txt = (Telerik.Reporting.Processing.TextBox)Telerik.Reporting.Processing.ElementTreeHelper.GetChildByName(section, "textBox1");
    object title = section.DataObject["Title"];
    if ((string)title == "Developer")
    {
        txt.Style.BackgroundColor = System.Drawing.Color.Blue;
    }
}
void DetailSection_ItemDataBinding_Using_ILayoutElementContainer_Children(object sender, EventArgs e)
{
    Processing.DetailSection processingInstance = (Processing.DetailSection)sender;
    Processing.ILayoutElementContainer processingContainer = processingInstance as Processing.ILayoutElementContainer;
    if (null != processingContainer)
    {
        foreach (Processing.LayoutElement processingChild in processingContainer.Children)
        {
            Processing.VisualElement visualChild = processingChild as Processing.VisualElement;
            if (null != visualChild)
            {
                visualChild.Style.BackgroundColor = System.Drawing.Color.Blue;
            }
        }
    }
}

See Also