Take the 2-minute tour ×  I am struggling how to set a custom
property which is suppose to point to an instance of my custom
class on an ASP.NET webcontrol.  Sample web control:  public
class CustomControl : System.Web.UI.WebControls.Panel   public
IFactory Factory { get; set; }  Code behind:  public partial
class Main : System.Web.UI.Page   public IFactory GetFactory {
get { return new CustomFactory(); }   public class CustomFactory
: IFactory {}  The custom factory get initialized on the code
behind. In my markup (not in code behind), I need to set the
Factory property on my CustomControl to the instance in my code
behind. Any variation of inline code that I tried did not work:
<asp:CustomControl ID="MyCustomControl" Factory="<%GetFactory%>"
runat="server" /> <asp:CustomControl ID="MyCustomControl"
Factory="<%=GetFactory%>" runat="server" />  Can anyone assist
how to do this?  share|improve this question Why does it have to
be in the markup? –  Dave Zych Oct 3 '12 at 18:32 To keep the
code behind clea