Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Design Time support for custom ASP.Net controls

Thread Tools

Design Time support for custom ASP.Net controls

Posts: n/a
I'm reposting this, because I had a bit of difficulty last time and think
that it might have fallen through the cracks. If I'm posting to the wrong
groups, please let me know. Surely someone has some experience with this...

I've been building custom web controls in C# with VS2005. Currently I'm
looking into adding design-time functionality and have reached a point where
I need to generate code in the page the custom control is on. Enter the
CodeDomSerializer class.

I've found several examples creating Designer Serializers, nearly all of
them for windows forms, but a few claiming to work for Web Controls;
however, I have been singularly unsuccessful at every attempt to modify
source code during the design-time experience. Clearly I'm doing something
wrong, but what it is escapes me.

Below is a sample of the technique I've been using, scaled down to the
barest minimum and excluding designers and other things you might expect for
a custom control. It appears to me that this should work, though adding this
"newtest" control to a page clearly does not add the comment expected.

Can anyone add some clarity at to what I'm doing wrong? Thank you in

-Jim Fisher

/--/begin sample code....
namespace testcontrol {
public partial class newtest : System.Web.UI.WebControls.TextBox {
public newtest() {
public newtest(IContainer container) {
internal class newtest_serializer : CodeDomSerializer {
public override object Deserialize(IDesignerSerializationManager
manager, object codeObject) {
CodeDomSerializer serial =
(CodeDomSerializer)manager.GetSerializer(typeof(ne wtest).BaseType,
return serial.Deserialize(manager,codeObject);
public override object Serialize(IDesignerSerializationManager
manager, object value) {
CodeDomSerializer serial =
(CodeDomSerializer)manager.GetSerializer(typeof(ne wtest).BaseType,
CodeStatementCollection statements =
(CodeStatementCollection)serial.Serialize(manager, value);
statements.Add(new CodeCommentStatement("//--Comment!--"));
return statements;

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Poor Design Time Support for DataBinding in Custom Controls Mark Olbert ASP .Net 1 02-17-2007 05:50 PM
Custom Control - Design Time Support =?Utf-8?B?U2ltb24=?= ASP .Net 0 01-24-2007 09:51 PM
Design Time Support for custom User Controls Darren Clark ASP .Net Building Controls 2 02-15-2006 10:00 PM
Web Custom Control - Design Time Support ? ? ? MLibby ASP .Net Building Controls 4 09-04-2004 01:57 PM
Custom collection design time support David Keenan ASP .Net Building Controls 2 10-13-2003 02:49 PM