This question has been asked a few dozen times before; but has never been solved.
i have an UpdatePanel
<asp:UpdatePanel ID="UpdatePanelSetupToolbar" runat="server">
<ContentTemplate>
...
</ContentTemplate>
</asp:UpdatePanel>
But the visual page designer in Visual Studio (2010 (Professional (Windows (7 (Professional (64-bit)))))) gives the error:
Error Creating Control - UpdatePanelSetupToolbar
Type 'System.Web.UI.UserControl' does not have a public property named 'ContentTemplate'.
Edit: pretty colors in pretty screenshots are added for pretty effect
Now, strictly speaking, that is true: UserControl
does not have a public property called ContentTemplate
.
Fortunately my UpdatePanel
is an UpdatePanel
, and it does have a public property named 'ContentTemplate'
.
So how do i convince Visual Studio that my UpdatePanel
is an UpdatePanel
?
The code above doesn't actually fail as is:
<asp:UpdatePanel ID="UpdatePanelSetupToolbar" runat="server">
<ContentTemplate>
...
</ContentTemplate>
</asp:UpdatePanel>
It only fails when i have content inside the ...
ContentTemplate:
<asp:UpdatePanel ID="UpdatePanelSetupToolbar" runat="server">
<ContentTemplate>
<Vista:Toolbar ID="ToolbarSetup" runat="server">
<ContentTemplate>
<asp:LinkButton ID="bbSetupDays" ToolTip="Specify how many allocations will be available on these selected days"
OnClick="bbSetupDays_Click"
runat="server">Setup Selected Days</asp:LinkButton>
</ContentTemplate>
</Vista:Toolbar>
</ContentTemplate>
</asp:UpdatePanel>
ToolbarSetup
UpdatePanelSetupToolbar
controlSo what's the deal with
Type '%s' does not have a public property named '%s'.
?
The ASP.net web-site compiles, builds, and runs fine. It's just the Visual Studio (2010) designer that complains.
So what's the deal with Type '%s' does not have a public property named '%s'.
?
This question is one in the ongoing Stackoverflow series, "Templating user controls":
The update panel is really cool but you really can't make user controls with it. The good news is you can make asp.net user controls that have a javascript payload by following the same design pattern used to make the updatepanel for the ajaxcontroltoolkit.
I built this back in Mar 2009 because I needed a message box that didn't block the ui. I followed the design pattern for usercontrols using the ajaxcontroltoolkit. It has complete source and the VS intelisense works on the javascript. It's a usercontrol that you just drop on the page and it carries it's own javascript payload that you can ajaxify to your hearts content. It even works in a data repeater with no modifications. It was actually accepted as a ajaxcontroltoolkit usercontrol on the website asp.net.
It's free you could put it on github or other repository if you wanted.
http://gosylvester.com/downloads/messagebox.aspx
http://gosylvester.com/blog.aspx?id=55
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With