ControlBuilder Class
Supports the page parser in building a control and the child controls it contains.
Assembly: System.Web (in System.Web.dll)
By default, every control on a page is associated with a default ControlBuilder class. During parsing, the ASP.NET page framework builds a tree of ControlBuilder objects corresponding to the tree of controls for the page. The ControlBuilder tree is then used to generate page code to create the control tree. In addition to child controls, the ControlBuilder defines the behavior of how the content within control tags is parsed. You can override this default behavior by defining your own custom control builder class. This is done by applying a ControlBuilderAttribute attribute to your control builder class as follows:
[ControlBuilderAttribute(typeof(ControlBuilderType))]
The following code example creates a Table control whose attributes and content are defined at the time the table is built. The following is the command line to use to build the executable.
[Visual Basic]
vbc /r:System.dll /r:System.Web.dll /r:System.Drawing.dll /t:library /out:myWebAppPath/Bin/vb_mycontrolbuilder.dll myControlBuilder.vb
[C#]
csc /t:library /out:myWebAppPath/Bin/cs_mycontrolbuilder.dll myControlBuilder.cs
The following code example uses the previous custom control. In particular, it builds a table whose attributes and content are defined at run time. Notice that the values shown in the @ Register directive reflect the previous command line.
- AspNetHostingPermission
for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.
- AspNetHostingPermission
for operating in a hosted environment. Demand value: InheritanceDemand; Permission value: Minimal.
System.Web.UI.ControlBuilder
System.Web.UI.DataSourceControlBuilder
System.Web.UI.HtmlControls.HtmlEmptyTagControlBuilder
System.Web.UI.HtmlControls.HtmlHeadBuilder
System.Web.UI.HtmlControls.HtmlSelectBuilder
System.Web.UI.MobileControls.DeviceSpecificChoiceControlBuilder
System.Web.UI.MobileControls.DeviceSpecificControlBuilder
System.Web.UI.MobileControls.MobileControlBuilder
System.Web.UI.ObjectTagBuilder
System.Web.UI.SkinBuilder
System.Web.UI.TemplateBuilder
System.Web.UI.UserControlControlBuilder
System.Web.UI.WebControls.HyperLinkControlBuilder
System.Web.UI.WebControls.LabelControlBuilder
System.Web.UI.WebControls.LinkButtonControlBuilder
System.Web.UI.WebControls.ListItemControlBuilder
System.Web.UI.WebControls.LiteralControlBuilder
System.Web.UI.WebControls.MultiViewControlBuilder
System.Web.UI.WebControls.PlaceHolderControlBuilder
System.Web.UI.WebControls.TableCellControlBuilder
System.Web.UI.WebControls.TextBoxControlBuilder
System.Web.UI.WebControls.WizardStepControlBuilder
System.Web.UI.WebControls.XmlBuilder
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.