Try Now
More in this section

Forums / Sitefinity SDK / Custom control from designer template

Custom control from designer template

1 posts, 0 answered
  1. Drew Greenwell
    Drew Greenwell avatar
    66 posts
    11 Feb 2010
    24 Mar 2011
    Link to this post
    I have a designer template. I would like to display some of our clients business controls in side of the designer template. Currently I get no output from the control. If I try to reference any child controls from the codebehind I receive a null reference exception..

    This is the section of code in my designer template
    <label>Example Custom Field</label>           
    <lfi:ExampleControl ID="Example1" runat="server" />
    <asp:HyperLink runat="server" ID="hyp" NavigateUrl="#">Test Link</asp:HyperLink>

    the label and hyperlink display but nothing is displayed for the example control.  If from the codebehind of the example control I call this.Controls.add(new TextBox(){ Text="test" });  A textbox will render. but if I try to add any custom control to the tree nothing is output. In fact, nothing from ExampleControl.ascx is being output at all unless it's added through the code behind, and then only built in controls seem to be rendered.. what gives?

    Is this a bug with the designer system? I don't believe this could be by design because it breaks compatibility with pretty much every single user control ever written.  It is not going to go over well with clients at all if they have to maintain two separate control libraries for basic things like this.
1 posts, 0 answered