Custom control from designer template

Posted by Community Admin on 05-Aug-2018 17:47

Custom control from designer template

All Replies

Posted by Community Admin on 24-Mar-2011 00:00

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.

This thread is closed