ControlBuilder.GetChildControlType Method (String, IDictionary)

 

Obtains the Type of the control type corresponding to a child tag. This method is called by the ASP.NET page framework.

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

Public Overridable Function GetChildControlType (
	tagName As String,
	attribs As IDictionary
) As Type

Parameters

tagName
Type: System.String

The tag name of the child.

attribs
Type: System.Collections.IDictionary

An array of attributes contained in the child control.

Return Value

Type: System.Type

The Type of the specified control's child.

This method is called by the ASP.NET page framework during parsing and is not intended to be called directly in you code.

' Create a custom ControlBuilder that interprets nested elements
' named myitem as TextBoxes. If this class is called in a 
' ControlBuilderAttribute applied to a custom control, when
' that control is created in a page and it contains child elements
' that are named myitem, the child elements will be rendered as 
' TextBox server controls. This control builder also ignores literal
' strings between elements when it is associated with a control.

<AspNetHostingPermission(SecurityAction.Demand, _
  Level:=AspNetHostingPermissionLevel.Minimal)> _
Public NotInheritable Class MyItemControlBuilder
  Inherits ControlBuilder

  ' Override the GetChildControlType method to detect
  ' child elements named myitem.
  Public Overrides Function GetChildControlType(ByVal tagName As String, ByVal attribs As IDictionary) As Type
     If [String].Compare(tagName, "myitem", True) = 0 Then
        Return GetType(TextBox)
     End If
     Return Nothing
  End Function 'GetChildControlType


  ' Override the AppendLiteralString method so that literal
  ' text between rows of controls are ignored.  
  Public Overrides Sub AppendLiteralString(s As String)
  End Sub 'AppendLiteralString
End Class 'MyItemControlBuilder ' Ignores literals between rows.

.NET Framework
Available since 1.1
Return to top
Show: