UserControlControlBuilder Class
Collapse the table of content
Expand the table of content

UserControlControlBuilder Class

Supports the page parser in building a user control and any child user controls that it contains.

For a list of all members of this type, see UserControlControlBuilder Members.


[Visual Basic]
Public Class UserControlControlBuilder
   Inherits ControlBuilder
public class UserControlControlBuilder : ControlBuilder
public __gc class UserControlControlBuilder : public ControlBuilder
public class UserControlControlBuilder extends ControlBuilder

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


By default, every user control on a page is associated with a default UserControlControlBuilder class. This class adds a child control to the Controls property for every nested user control that it encounters within the custom control tags. Additionally, it creates literal controls for the text located between nested control tags. You can create custom user control builder funtionality by extending this class.


[Visual Basic] The following example creates a custom UserControlControlBuilder class that overrides the AllowWhitespaceLiterals method that this class inherits from the ControlBuilder class. When applied to a UserControl class, white spaces found in the user control are ignored.

[Visual Basic] 
' This is a Custom builder for user controls.
' It does not allow white space to be returned
' as instances of the LiteralControl class.
Public Class CustomUCBuilder
   Inherits UserControlControlBuilder
    Public Sub New()
    End Sub
  ' UserControlControlBuilder inherits this from
  ' ControlBuilder, but uses the base functionality
  ' of the method. You can override it to 
  ' create the custom behavior you want.  
  Public Overrides Function AllowWhitespaceLiterals() As Boolean
     Return False
  End Function
End Class

[C#, C++, JScript] No example is available for C#, C++, or JScript. To view a Visual Basic example, click the Language Filter button Language Filter in the upper-left corner of the page.


Namespace: System.Web.UI

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

Assembly: System.Web (in System.Web.dll)

See Also

UserControlControlBuilder Members | System.Web.UI Namespace | UserControl | ControlBuilder

© 2015 Microsoft