ActiveReports Developers 7 Now Available in Beta!! (click for details)

ActiveReports 6 Support

Started by jpierson at 12-30-2009 12:36 PM. Topic has 2 replies.

Print Search Rate
Sort Posts:    
   12-30-2009, 12:36 PM
jpierson is not online. Last active: 10/19/2011 4:19:44 PM jpierson

Top 75 Posts
Joined on 04-10-2009
Posts 151
What is the best place to modify the Visibility of a control or section?
What is the best place to modify the Visibility of a control or section? Format event, BeforePrint, or AfterPrint events.

I'm wondering where in the process relative to these events that the backing fields are set also when are bound field values applied to controls. What I'm wondering is that by the time the Format event fires, if I check the TextBox.Value property will that control hold the value from it's bound field? Is this the preferred place and way to then modify the visibility of the corresponding control/section.

   Report 
   12-31-2009, 3:21 AM
AashishB is not online. Last active: 12/24/2010 3:51:14 PM AashishB

Top 25 Posts
Joined on 12-11-2008
Posts 818
Re: What is the best place to modify the Visibility of a control or section?
jpierson,

I would suggest you to go through the part of the documentation which explains about the section events from this link.

ActiveReports raises Format event after the data is loaded and bound to the controls contained in a section, but before the section is rendered to a page.
ActiveReports raises Before Print event before the section is rendered to the page. The growing and shrinking of the section and its controls have already taken place, therefore:
the visibility of the section can be changed in Format Event but cannot be changed in the BeforePrint Event. 
The visiblity of the control can be changed in both the Format event and the BeforePrint event.

But significantly, the section would shrink/ expand according to the controls in it. If you do not hide a particular control in the format event which has height more than the section's height, then the even if you hide the control in the Before Print Event, there would empty vertical space in the Section. Because section would not be able to reduce its height in the Before Print Event.

Regards,
Aashish



   Report 
   12-31-2009, 10:29 AM
jpierson is not online. Last active: 10/19/2011 4:19:44 PM jpierson

Top 75 Posts
Joined on 04-10-2009
Posts 151
Re: What is the best place to modify the Visibility of a control or section?
Great information, it's all pretty clear to me now.

For those that might care, the main reason I was curious about about this is because I was wondering if there was any optimizations to skip the binding of particular fields to controls if those controls are not visible. Although if such optimization existed it would only benefit particular reports which have a significant amount of globally hidden controls bound to unique fields at given run. In cases where this might be true especially for cases where there is complex formatting the potential increase in performance may be noticeable.

Based off of the information provided though about binding happening before the Format event, it seems that from a normal programmers stand point it would be to late to make such optimizations. This makes sense because if you needed to conditionally format or style a control based off of the Value then the data needs to be bound to that control at that time.

The most straight forward way to achieve the type of optimizations I'm talking about then would probably be to remove the control itself from the report so that it is skipped entirely for a whole run of a report.

   Report 
GrapeCity » Product Support » ActiveReports 6... » What is the best place to modify the Visibility of a control or section?

Privacy Policy | Copyright © 1997-2012 — GrapeCity, inc.
All trademarks mentioned are the property of their respective owners.