ASP.NET.in.a.Nutshell.Second.Edition [Electronic resources]

G. andrew Duthie; matthew Macdonald

نسخه متنی -صفحه : 873/ 403
نمايش فراداده

ControlBuilder

System.Web.UI (system.web.dll)class

This class is used transparently by the ASP.NET network when generating a Page object. It works with the appropriate parser object to build the relevant controls. You can derive from this class to create your custom control builders for your custom controls. Just override the appropriate methods and apply the ControlBuilderAttribute to your control class to instruct ASP.NET to use your custom ControlBuilder. For example, you could override the AllowWhitespaceLiterals( ) method to return False. This override instructs ASP.NET to refrain from creating LiteralControl objects for any whitespace it finds inside a control. Note, however, that it is easiest and most common to use the standard ControlBuilder for your custom controls.

public class 

ControlBuilder { // Public Constructors public

ControlBuilder ( ); // Public Instance Properties public Type

ControlType {get; } public bool

HasAspCode {get; } public string

ID {set; get; } public Type

NamingContainerType {get; } public string

TagName {get; } // Protected Instance Properties protected bool

FChildrenAsProperties {get; } protected bool

FIsNonParserAccessor {get; } protected bool

InDesigner {get; } protected TemplateParser

Parser {get; } // Public Static Methods public static ControlBuilder

CreateBuilderFromType (TemplateParser

parser , ControlBuilder

parentBuilder , Type

type , string

tagName , string

id , System.Collections.IDictionary

attribs , int

line , string

sourceFileName ); // Public Instance Methods public virtual bool

AllowWhitespaceLiterals ( ); public virtual void

AppendLiteralString (string

s ); public virtual void

AppendSubBuilder (ControlBuilder

subBuilder ); public virtual void

CloseControl ( ); public virtual Type

GetChildControlType (string

tagName , System.Collections.IDictionary

attribs ); public virtual bool

HasBody ( ); public virtual bool

HtmlDecodeLiterals ( ); public virtual void

Init (TemplateParser

parser , ControlBuilder

parentBuilder , Type

type , string

tagName , string

id , System.Collections.IDictionary

attribs ); public virtual bool

NeedsTagInnerText ( ); public virtual void

OnAppendToParentBuilder (ControlBuilder

parentBuilder ); public virtual void

SetTagInnerText (string

text ); }

Subclasses

Multiple types

Passed To

ObjectTagBuilder.{AppendSubBuilder( ), Init( )}