Chapter 13. Writing Custom Controls and Contributing to the Community

As you have seen in Chapter 10, Chapter 11, and Chapter 12, the ASP.NET AJAX Control Toolkit offers a number of valuable controls. This chapter will go one step further by demonstrating how to use the toolkit infrastructure to write your own controls. You will also be introduced to some of the methods to contribute to the Toolkit community at large.

Writing Custom ASP.NET AJAX Controls

The array of controls offered by the ASP.NET AJAX Control Toolkit continues to expand from release to release. Yet in addition to this already impressive list is a framework for creating your own custom controls. If you find yourself using the same JavaScript effects over and over, making them available for reuse via ASP.NET AJAX is a good idea.

In this section, you’ll create an extender that restricts input into an HTML text box to a set of predefined characters—functionality not offered by HTML. The ASP.NET AJAX Control Toolkit provides a project template for Visual Studio 2005 to facilitate this work. You begin by installing the template, then modify it and add the logic for the new extender.

As you’ve seen, the ASP.NET AJAX Control Toolkit comes as one DLL file that contains the complete set of controls. To create a custom control, you will need to compile code. Fortunately, the toolkit is equipped with a Visual Studio template that makes it easy to generate extenders such as the one we are about to create.

In Chapter 10 you were ...

Get Programming ASP.NET AJAX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.