in

ASP.NET Weblogs

The ASPSmith's Blog

Some rants about ASP.NET by Steven Smith

Evolving Custom Web Controls

Although sometimes you start out knowing you need a custom control, what more often happens is you find that you're using the same functionality in more than one place, so you start packaging it up into a control in order to remove duplication and improve reusability.  This article takes a look at when and how you should do such things by taking a fairly simple piece of ASP.NET functionality and evolving it from some code on a form to a user control to a fully-functional custom web control.

http://msdn.microsoft.com/asp.net/using/building/webcontrols/default.aspx?pull=/library/en-us/dnaspp/html/aspnet-evolvecustomcontrols.asp

Published Dec 12 2003, 08:06 PM by ASPSmith
Filed under:

Comments

 

AndrewSeven said:

I get an error at design time from VS.NEt 2002 if the CompositeControl is abstract...

Try adding this to your CompositeControl, I get a good rendition of the child controls.

protected override void Render(HtmlTextWriter output)
{
EnsureChildControls();
base.Render(output);

}


-A
December 13, 2003 12:15 AM

Leave a Comment

(required)  
(optional)
(required)  
Add