4

Is it possible to get design mode to work for templated user controls? I have tried following the How to: Create Templated ASP.NET User Controls on MSDN, and also tried the various tips at the bottom of page for version 2.0 of the framework, but alas, I still get the dreaded "Error creating user control" error, when switching to design view.

Should I just give up, and switch to a custom server control?

Jan Aagaard
  • 10,940
  • 8
  • 45
  • 80
  • I have been fighting this frustration as well. – CleverPatrick Aug 10 '09 at 16:01
  • can you send me the user control code and the page wher ur using the control code. so tat its easy to find the issue where it resides exactly – solairaja Nov 04 '09 at 10:49
  • @solariaja: You can use the C# code on the MSDN web site. – Jan Aagaard Nov 04 '09 at 12:30
  • 1
    I've tested this in Visual Studio 2010, and I get the same error as in 2008 - Type 'System.Web.UI.UserControl' does not have a public property named 'MessageTemplate'. There doesn't seem to be a way to convince the Designer to use the Type of the user control. At least with a custom server control you have complete control over the Designer rendering. – Graham Clark Nov 04 '09 at 14:08

2 Answers2

4

There is a Connect bug filed on this as well as several comments on the VS2005 version of the MSDN page. Apparently this is a long-running defect that hasn't been fixed and hasn't got a solution. In ScottGu's post about this feature, he acknowledges this doesn't work (in the comments) and points the commenters to the CompositeControl base class if they want designer support.

Probably not the answer you were hoping for, but it sounds like there's no real solution for the issue except moving to server controls.

Travis Illig
  • 23,195
  • 2
  • 62
  • 85
0

I was never able to get it to work either. It can be done easily with a regular server control, though. I posted a quick example as an answer to this question: ASP.NET: User control with access to the controls that it wraps

Community
  • 1
  • 1
Matthew
  • 2,210
  • 1
  • 19
  • 30