ControlBuilder.GetChildControlType Method
.NET Framework 3.0
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)
Assembly: System.Web (in system.web.dll)
public Type GetChildControlType ( String tagName, IDictionary attribs )
public function GetChildControlType ( tagName : String, attribs : IDictionary ) : Type
Not applicable.
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.
// 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 extends ControlBuilder
{
// Override the GetChildControlType method to detect
// child elements named myitem.
public Type GetChildControlType(String tagName, IDictionary attributes)
{
if (String.Compare(tagName, "myitem", true) == 0) {
return TextBox.class.ToType();
}
return null;
} //GetChildControlType
// Override the AppendLiteralString method so that literal
// text between rows of controls are ignored.
public void AppendLiteralString(String s)
{
// Ignores literals between rows.
} //AppendLiteralString
} //MyItemControlBuilder
Community Additions
ADD
Show: