Note that there are some explanatory texts on larger screens.

plurals
  1. POUserControl does not have public property named ContentTemplate
    text
    copied!<p>This question has been asked a few dozen times before; but has never been solved.</p> <p>i have an <strong><code>UpdatePanel</code></strong></p> <pre><code>&lt;asp:UpdatePanel ID="UpdatePanelSetupToolbar" runat="server"&gt; &lt;ContentTemplate&gt; ... &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; </code></pre> <p>But the <em>visual page designer</em> in Visual Studio (2010 (Professional (Windows (7 (Professional (64-bit)))))) gives the error:</p> <blockquote> <p><strong>Error Creating Control</strong> - UpdatePanelSetupToolbar</p> <p>Type 'System.Web.UI.UserControl' does not have a public property named 'ContentTemplate'.</p> </blockquote> <p><img src="https://i.stack.imgur.com/JAFPt.png" alt="enter image description here"><br> <sup><sup><em>Edit: pretty colors in pretty screenshots are added for pretty effect</em></sup></sup></p> <p>Now, strictly speaking, that is true: <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.usercontrol_properties" rel="nofollow noreferrer"><code>UserControl</code></a> does <strong>not</strong> have a public property called <code>ContentTemplate</code>.</p> <p>Fortunately my <code>UpdatePanel</code> is an <strong><code>UpdatePanel</code></strong>, and it <strong>does</strong> have a public property named <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.updatepanel.contenttemplate.aspx" rel="nofollow noreferrer"><code>'ContentTemplate'</code></a>.</p> <p>So how do i convince Visual Studio that my <code>UpdatePanel</code> is an <code>UpdatePanel</code>?</p> <h2>Important additional notes</h2> <p>The code above doesn't actually fail as is:</p> <pre><code>&lt;asp:UpdatePanel ID="UpdatePanelSetupToolbar" runat="server"&gt; &lt;ContentTemplate&gt; ... &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; </code></pre> <p>It only fails when i have content inside the <code>...</code> ContentTemplate:</p> <pre><code> &lt;asp:UpdatePanel ID="UpdatePanelSetupToolbar" runat="server"&gt; &lt;ContentTemplate&gt; &lt;Vista:Toolbar ID="ToolbarSetup" runat="server"&gt; &lt;ContentTemplate&gt; &lt;asp:LinkButton ID="bbSetupDays" ToolTip="Specify how many allocations will be available on these selected days" OnClick="bbSetupDays_Click" runat="server"&gt;Setup Selected Days&lt;/asp:LinkButton&gt; &lt;/ContentTemplate&gt; &lt;/Vista:Toolbar&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; </code></pre> <ul> <li>but Visual Studio is not complaining about inner <code>ToolbarSetup</code></li> <li>it's complaining about the outer <code>UpdatePanelSetupToolbar</code> control</li> </ul> <p>So what's the deal with </p> <blockquote> <p>Type '%s' does not have a public property named '%s'.</p> </blockquote> <p>?</p> <h2>Unimportant additional notes</h2> <p>The ASP.net web-site compiles, builds, and runs <em>fine</em>. It's just the Visual Studio (2010) designer that complains.</p> <p>So what's the deal with <code>Type '%s' does not have a public property named '%s'.</code>?</p> <h2>Series</h2> <p>This question is one in the ongoing Stackoverflow series, <strong>"Templating user controls"</strong>:</p> <ul> <li><a href="https://stackoverflow.com/questions/11658053/how-to-add-a-templating-to-a-usercontrol/11700540">How to add a Templating to a UserControl?</a></li> <li><a href="https://stackoverflow.com/questions/12323303/how-to-inherit-from-control-rather-than-usercontrol">How to inherit from Control, rather than UserControl?</a></li> <li><a href="https://stackoverflow.com/questions/12321621/usercontrol-has-ispostback-but-control-does-not/12321692">UserControl has IsPostBack, but Control does not</a></li> <li><a href="https://stackoverflow.com/questions/11656637/usercontrol-does-not-have-public-property-named-contenttemplate">UserControl does not have public property named ContentTemplate</a></li> <li><a href="https://stackoverflow.com/questions/12325192/how-do-i-specify-codefilebaseclass-from-web-config">How do i specify CodeFileBaseClass from web.config?</a></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload