This is a migrated thread and some comments may be shown as answers.

Serialize a report with events

1 Answer 86 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
JC Wu
Top achievements
Rank 1
JC Wu asked on 17 Nov 2011, 10:53 AM
I have a report with some event handler like below.
private void groupFooterSection2_ItemDataBinding(object sender, EventArgs e)
{
    Telerik.Reporting.Processing.GroupSection procGroup = sender as Telerik.Reporting.Processing.GroupSection;
 
    DataRowView row = procGroup.DataObject.RawData as DataRowView;
     
    if (row["group1"].ToString() == "")
    { 
        procGroup.Visible = false;   
    }
}
I serialize it into XML file, and then deserialize XML file to report.
The event doesn't work anymore.
Any suggestion?

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 18 Nov 2011, 02:22 PM
Hello Jc Wu,

You should keep in mind that when you are serializing the report, you serialize only the report definition. Events, user functions and everything else added in the code behind are not included. Please, note that the XML serialization engines in general work by serializing the public properties/collections of a class. In your case 'ItemDataBinding' is a private method of your custom class (report definition) and there is no way for the serialization engine to know about this method.

Instead of events our suggestion is to conditionally control the items/sections Visibility with Conditional Formatting or Binding based on a expressions. Check out the following example:
Property path Expression 
 Visible  = IsNull(Fields.group1,"")<>""

All the best,
Peter
the Telerik team

Q2’11 SP1 of Telerik Reporting is available for download (see what's new). Get it today.

Tags
General Discussions
Asked by
JC Wu
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or