Last post Jan 13, 2010 06:20 PM by rtpHarry
Jan 13, 2010 04:10 PM|josamoto|LINK
I'm trying to develop a user control that decorates user content with some HTML. The usage of the component looks like this (Default.aspx):
The code compiles perfectly, as we can see here:
------ Rebuild All started: Project: ControlTest, Configuration: Debug Any CPU ------
ControlTest -> C:\Users\...\ControlTest\ControlTest\bin\ControlTest.dll
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
What is wrong with this is the Design View in Visual Studio. It complains about the following:
Error Creating Control - MyControl1Literal content ('Decorate me with HEADER and FOOTER...') is not allowed within a 'System.Web.UI.UserControl'.
Does anyone know how to fix this? It's annoying, and first of all, does not make sense that the compiler does not throw an error, but the design view does?
Running the code does exactly what is expected.
I read a couple of articles on MSDN on creating Templated User Controls, and some users made comments that this is a bug in Visual Studio. Please help!
templated custom control template user control
Jan 13, 2010 06:20 PM|rtpHarry|LINK
Its a a bug in visual studio and there is no way around it.
It wasn in the older asp.net 2.0 visual studio (2003 i think) and its fixed in vs 2010 but if you are using 2008 you are out of luck.
The code will still compile and you can use it but the designer doesn't support it. I spent hours trying ever combination suggested out there and I am pretty sure nothing will work.