ControlBuilder.GetChildControlType(String, IDictionary) ControlBuilder.GetChildControlType(String, IDictionary) ControlBuilder.GetChildControlType(String, IDictionary) ControlBuilder.GetChildControlType(String, IDictionary) Method

Определение

Получает Type типа элемента управления, соответствующего тегу дочернего элемента.Obtains the Type of the control type corresponding to a child tag. Этот метод вызывается платформой страницы ASP.NET.This method is called by the ASP.NET page framework.

public:
 virtual Type ^ GetChildControlType(System::String ^ tagName, System::Collections::IDictionary ^ attribs);
public virtual Type GetChildControlType (string tagName, System.Collections.IDictionary attribs);
abstract member GetChildControlType : string * System.Collections.IDictionary -> Type
override this.GetChildControlType : string * System.Collections.IDictionary -> Type
Public Overridable Function GetChildControlType (tagName As String, attribs As IDictionary) As Type

Параметры

tagName
String String String String

Имя тега дочернего элемента.The tag name of the child.

attribs
IDictionary IDictionary IDictionary IDictionary

Массив атрибутов, содержащихся в дочернем элементе управления.An array of attributes contained in the child control.

Возвраты

Type указанного дочернего элемента управления.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.
[AspNetHostingPermission(SecurityAction.Demand, 
   Level=AspNetHostingPermissionLevel.Minimal)]
public sealed 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.
   }
}
' 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
End Class

Комментарии

Этот метод вызывается инфраструктурой страниц ASP.NET во время синтаксического анализа и не предназначен для непосредственного вызова в коде.This method is called by the ASP.NET page framework during parsing and is not intended to be called directly in you code.

Применяется к