Building On Existing Controls
By overriding the Render() method of the base Control class, you can build very powerful controls. However, often you will find that there is an existing control that has most of the functionality you need. In this case, it is often much more efficient to simply inherit from the control that has most of your functionality. A common example of this kind of control would be a DropDownList that you would like to have pre-populated. Consider a form that has many yes or no questions on it. You might want to have a DropDownList with options for Yes, No, and a blank default option. You could create a custom control from scratch with this functionality, but you would not have any of the built-in functionality of the DropDownList ...
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.