System.Web.UI.ControlBuilder.Init C# (CSharp) Méthode

Init() public méthode

public Init ( System.Web.UI.TemplateParser parser, ControlBuilder parentBuilder, Type type, string tagName, string id, IDictionary attribs ) : void
parser System.Web.UI.TemplateParser
parentBuilder ControlBuilder
type Type
tagName string
id string
attribs IDictionary
Résultat void
		public virtual void Init (TemplateParser parser,
					  ControlBuilder parentBuilder,
					  Type type,
					  string tagName,
					  string id,
					  IDictionary attribs)
		{
			this.parser = parser;
			if (parser != null)
				this.Location = parser.Location;

			this.parentBuilder = parentBuilder;
			this.type = type;
			this.tagName = tagName;
			this.id = id;
			this.attribs = attribs;
			if (type == null)
				return;

			if (this is TemplateBuilder)
				return;

			object [] atts = type.GetCustomAttributes (typeof (ParseChildrenAttribute), true);
			
			if (!typeof (IParserAccessor).IsAssignableFrom (type) && atts.Length == 0) {
				isIParserAccessor = false;
				childrenAsProperties = true;
			} else if (atts.Length > 0) {
				ParseChildrenAttribute att = (ParseChildrenAttribute) atts [0];
				childrenAsProperties = att.ChildrenAsProperties;
				if (childrenAsProperties && att.DefaultProperty.Length != 0)
					defaultPropertyBuilder = CreatePropertyBuilder (att.DefaultProperty,
											parser, null);
			}
		}

Usage Example

Exemple #1
0
		public void Deny_Unrestricted ()
		{
			ControlBuilder cb = new ControlBuilder ();
			Assert.IsNull (cb.ControlType, "ControlType");
			Assert.IsFalse (cb.HasAspCode, "HasAspCode");
			cb.ID = "mono";
			Assert.AreEqual ("mono", cb.ID, "ID");
			Assert.AreEqual (typeof (Control), cb.NamingContainerType, "NamingContainerType");
			Assert.IsNull (cb.TagName, "TagName");
			Assert.IsTrue (cb.AllowWhitespaceLiterals (), "AllowWhitespaceLiterals");
			cb.AppendLiteralString ("mono");
			cb.AppendSubBuilder (cb);
			cb.CloseControl ();
			Assert.IsNull (cb.GetChildControlType (null, null), "GetChildControlType");
			Assert.IsTrue (cb.HasBody (), "HasBody");
			Assert.IsFalse (cb.HtmlDecodeLiterals (), "HtmlDecodeLiterals");
			cb.Init (null, cb, typeof (TemplateBuilder), "span", "mono", null);
			Assert.IsFalse (cb.NeedsTagInnerText (), "NeedsTagInnerText");
			//cb.OnAppendToParentBuilder (null);
			cb.SetTagInnerText ("mono");

			cb = ControlBuilder.CreateBuilderFromType (null, cb, typeof (TemplateBuilder), "span", "mono", null, 0, String.Empty);
			Assert.IsNotNull (cb, "CreateBuilderFromType");
		}