O'Reilly logo

Special Edition Using® Microsoft® ASP.NET by Richard Leinecker

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 and Using Composite Controls

This example showsyou how to write a control that composes itself from other server controls. The capability to do this is especially useful if you already have controls with functionality that you need and you just want to create a super-class that does much more. Listing 13.10 shows the control’s source code, and Listing 13.11 shows the .aspx file that uses it.

Listing 13.10. The Control’s Code Composed from Other Server Controls
 namespace MyContro { [ShowInToolbox(true), ToolboxData(“<{0}:Composition1 runat=server></{0}:Composition1>”)] public class Composition1 : System.Web.UI.WebControls.WebControl, INamingContainer { public int Value { get { return Int32.Parse(((TextBox)Controls[1]).Text); } set { ...

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