This documentation is archived and is not being maintained.
ControlBuilder.GetChildControlType Method
.NET Framework 1.1
Obtains the Type for the control's children.
[Visual Basic] Public Overridable Function GetChildControlType( _ ByVal tagName As String, _ ByVal attribs As IDictionary _ ) As Type [C#] public virtual Type GetChildControlType( string tagName, IDictionary attribs ); [C++] public: virtual Type* GetChildControlType( String* tagName, IDictionary* attribs ); [JScript] public function GetChildControlType( tagName : String, attribs : IDictionary ) : Type;
Parameters
- tagName
- The tag name of the child.
- attribs
- An array of attributes contained in the child control.
Return Value
The Type of the specified control's child.
Example
[Visual Basic] ' 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. Public 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. [C#] // 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. public class MyItemControlBuilder : ControlBuilder { // Override the GetChildControlType method to detect // child elements named myitem. public override Type GetChildControlType(String tagName, IDictionary attributes) { if (String.Compare(tagName, "myitem", true) == 0) { return typeof(TextBox); } return null; } // Override the AppendLiteralString method so that literal // text between rows of controls are ignored. public override void AppendLiteralString(string s) { // Ignores literals between rows. } } [C++] // 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. public __gc class MyItemControlBuilder : public ControlBuilder { // Override the GetChildControlType method to detect // child elements named myitem. public: Type * GetChildControlType(String* tagName, IDictionary* attributes) { if (String::Compare(tagName, S"myitem", true) == 0) { return __typeof(TextBox); } return 0; } // Override the AppendLiteralString method so that literal // text between rows of controls are ignored. public: void AppendLiteralString(String* s) { // Ignores literals between rows. } };
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
See Also
ControlBuilder Class | ControlBuilder Members | System.Web.UI Namespace
Show: