O'Reilly logo

Applied ASP.NET 4 in Context by Adam Freeman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating Custom Controls

You've seen how a user control can group together and extend existing Web Forms controls, and how to use adapters to take responsibility for the HTML that a control renders. But if you want to create an entirely new kind of element, then you need to create a custom server control.

Most of the time, user controls or control adapters will allow you to achieve the effect you require, so creating a server control is a pretty unusual thing to do.

In order to demonstrate the process of building a custom control, we will create one that neatly displays the results of the swimming calculation performed earlier in the chapter. This is something that could easily be done as a user control, but we'll do it as a server control instead. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required