Using Templates

Within your custom control, it is possible to add support for user-defined templates, such as the ones that you learned about in Chapter 5, “HTML/Web Controls.” Again, one of the great things about ASP.NET is that you have as much control over your custom controls as Microsoft has when they build their controls. If you see a feature of an existing control, such as the Repeater, that you'd like to implement in your own custom control, you can!

Templates are all about user interface. They allow your control to define one or more templates that can be customized by the user. Your control then defines when and how these templates are rendered. A common use for templates in the list controls was to have an ItemTemplate and an AlternateItemTemplate ...

Get ASP.NET by Example 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.