issue with View.OnLoad() method

Topics: CAB & Smart Client Software Factory
Aug 30, 2006 at 12:04 PM
originally posted by: MiniMe

When creating a view through the recipe, it overrides the OnLoad method, but it does not propagate the call to base.OnLoad. I have some views that inherit from a base class, and that class subscribes to the Load event to do some initialization. It's not a big deal, but everytime I create a view, I have to go and fix the OnLoad method to propagate the call to the base in order for the event to be raised.
I guess I'm asking if there's a specific reason for the ommission of that call to the base class, or just an oversight? If there's no good reason, can that that call to the base class be put in the next release, please :)
It's not a big deal, more of a nuisance, but it does break the convention for the control.
Sep 1, 2006 at 10:55 AM
originally posted by: marianoszklanny

It was an oversight - the call to the OnLoad method of the base class should be included in the generated OnLoad method.

To fix this issue, you must modify the guidance package:

1. Open the guidance package solution, GuidanceAutomation.sln
2. Open the file Templates\Items\View\View.cs.t4 under the SmartClientDevelopment project. This file is the template for the View.cs file that is generated when executing the View (with Presenter) recipe.
3. Replace the OnLoad method with the following code:

protected override void OnLoad(EventArgs e)

4. Build the solution
5. Either register the guidance package or install it.

Thanks for the feedback!

Mariano Szklanny