﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WebForms (How do I?)  » Business Object in User Control</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 09:04:13 GMT</lastBuildDate><ttl>20</ttl><item><title>Business Object in User Control</title><link>http://forum.strataframe.net/FindPost4152.aspx</link><description>For making any Business Object accessible in any webpage, i inherit the webpage from ApplicationBasePage but i cant do the same with a User Control, so how can i make any business object available to my User Controls ?</description><pubDate>Mon, 06 Nov 2006 12:40:37 GMT</pubDate><dc:creator>Vikram Saxena</dc:creator></item><item><title>RE: Business Object in User Control</title><link>http://forum.strataframe.net/FindPost4165.aspx</link><description>What we always do is create a property and then set that property in the Load or the property sheet (depending on how you design it) of the page that uses the control.&amp;nbsp; This way the control is encapsulated, as it should be.&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;Public Property MyCustomers As CustomersBO&lt;BR&gt;...&lt;BR&gt;End Property&lt;/P&gt;&lt;P&gt;This way your control can use the BO that comes from the ApplicationBasePage by simply setting the property when the page is loaded.&amp;nbsp; Then your control will reference the property instead whenever it needs to access the BO inside of the control.</description><pubDate>Mon, 06 Nov 2006 12:40:37 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Business Object in User Control</title><link>http://forum.strataframe.net/FindPost4162.aspx</link><description>Hello Trent,&lt;/P&gt;&lt;P&gt;The BusinessObject works fine in an .aspx page because the aspx page is inherited from ApplicationBasePage but the user control cant refer to the same business object because it is not inherited from the ApplicationBAsePage and I dont think if it can be inherited from applicationbasepage as well. following is a code snippet from Aspx page [which works fine] and from .ascx control [which throws a compilation error since it does not know where the business object is]&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size=3&gt;Code for .ASCX [ User Control]&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;FONT color=#0000ff&gt;&lt;P&gt;Partial&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;Class&lt;/FONT&gt;&lt;FONT color=#000000&gt; ListControls_CompanyList&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;Inherits&lt;/FONT&gt; System.Web.UI.UserControl&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;Protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Sub&lt;/FONT&gt; Page_Load(&lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; sender &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Object&lt;/FONT&gt;, &lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; e &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; System.EventArgs) &lt;FONT color=#0000ff&gt;Handles&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Me&lt;/FONT&gt;.Load&lt;/P&gt;&lt;P&gt;GridView1.DataSource = oCompanyBO.GetAll(&lt;FONT color=#800000&gt;"vik"&lt;/FONT&gt;)&lt;/P&gt;&lt;P&gt;DataBind()&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;End&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Sub&lt;/P&gt;&lt;P&gt;End&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;Class&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff size=3&gt;&lt;STRONG&gt;Code for ASPX page inherited from ApplicationBase Page.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;&lt;P&gt;Partial&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;Class&lt;/FONT&gt;&lt;FONT color=#000000&gt; List_Company&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;Inherits&lt;/FONT&gt; MyAppBasePage&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;Protected&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Sub&lt;/FONT&gt; Page_Load(&lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; sender &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Object&lt;/FONT&gt;, &lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; e &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; System.EventArgs) &lt;FONT color=#0000ff&gt;Handles&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Me&lt;/FONT&gt;.Load&lt;/P&gt;&lt;P&gt;GridView1.DataSource = oCompanyBO.GetAll(&lt;FONT color=#800000&gt;"vik"&lt;/FONT&gt;)&lt;/P&gt;&lt;P&gt;DataBind()&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;End&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Sub&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;P&gt;End&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;Class&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description><pubDate>Mon, 06 Nov 2006 11:11:28 GMT</pubDate><dc:creator>Vikram Saxena</dc:creator></item><item><title>RE: Business Object in User Control</title><link>http://forum.strataframe.net/FindPost4158.aspx</link><description>You will take the same approach as the previos post I made mentioning the definition of BOs in your ApplicationBasePage.&lt;/P&gt;&lt;P&gt;&lt;A href="http://forum.strataframe.net/Topic4019-8-1.aspx#bm4151"&gt;http://forum.strataframe.net/Topic4019-8-1.aspx#bm4151&lt;/A&gt;&amp;nbsp;</description><pubDate>Mon, 06 Nov 2006 10:20:02 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>