StrataFrame Forum

Are BO's not available during the Init event?

http://forum.strataframe.net/Topic7198.aspx

By Justin Buist - 2/27/2007

I'm looking to smack some controls onto my web form dynamically, and I'd like to do it within the Init event.



Problem is, the BO declared in ApplicationBasePage is Nothing when my code executes. It becomes a valid reference later on, but not during Init.



Did I do something wrong or is this just part of the SF design? I can see in the documentation that the BO's are populated on the Form Load event, but I think that's just talking about the WinForms side of things; I'm not sure if the same applies to the WebForms.
By StrataFrame Team - 2/27/2007

Yes, the business objects are created in the Load event as well.  What SF does is cycle through all of the business objects declared within the ApplicationBasePage class and either create the objects or pull them from the session variables.  So, if you need the business object within the Init event, you can either pull it from the session variable with the same name if this is not the first page in the session or if this is the first page in the session, you can do the work for the ApplicationBasePage and go ahead and create the business object and stuff it in the session variable.