void AddChild(object child) { if (children == null) { children = new ArrayList(); } children.Add(child); ControlBuilder cb = child as ControlBuilder; if (cb != null && cb is TemplateBuilder) { if (templateChildren == null) { templateChildren = new ArrayList(); } templateChildren.Add(child); } if (parser == null) { return; } string tag = cb != null ? cb.TagName : null; if (String.IsNullOrEmpty(tag)) { return; } RootBuilder rb = Root; AspComponentFoundry foundry = rb != null ? rb.Foundry : null; if (foundry == null) { return; } AspComponent component = foundry.GetComponent(tag); if (component == null || !component.FromConfig) { return; } parser.AddImport(component.Namespace); parser.AddDependency(component.Source); }
public override Type GetChildControlType(string tagName, IDictionary attribs) { if (tagName == null) { throw new ArgumentNullException("tagName"); } AspComponent component = foundry.GetComponent(tagName); if (component != null) { #if NET_2_0 if (!String.IsNullOrEmpty(component.Source)) { TemplateParser parser = Parser; if (component.FromConfig) { string parserDir = parser.BaseVirtualDir; VirtualPath vp = new VirtualPath(component.Source); if (parserDir == vp.Directory) { throw new ParseException(parser.Location, String.Format("The page '{0}' cannot use the user control '{1}', because it is registered in web.config and lives in the same directory as the page.", parser.VirtualPath, vp.Absolute)); } Parser.AddDependency(component.Source); } } #endif return(component.Type); } else if (component != null && component.Prefix != String.Empty) { throw new Exception("Unknown server tag '" + tagName + "'"); } return(LookupHtmlControls(tagName, attribs)); }