Beispiel #1
0
        public void LoadControl(ServerControlNode controlNode, WebFormContainer container, string prefix = null)
        {
            var prependingTagNames = new string[]
            {
                "asp:panel"
            };
            string newPrefix = prefix ?? string.Empty;

            if (controlNode.Attributes.ContainsKey("id"))
            {
                var controlItem = new WebFormServerControl
                {
                    TagName   = controlNode.TagName,
                    ControlID = controlNode.Attributes["id"],
                    Prefix    = prefix
                };
                container.Controls.Add(controlItem);
                if (prependingTagNames.Contains(controlItem.TagName, StringComparer.CurrentCultureIgnoreCase))
                {
                    newPrefix += controlItem.ControlID + "_";
                }
            }
            var childControlNodeList = controlNode.Children.Where(i => i is ServerControlNode);

            foreach (ServerControlNode childControlNode in childControlNodeList)
            {
                this.LoadControl(childControlNode, container, newPrefix);
            }
        }
Beispiel #2
0
		public void LoadControl(ServerControlNode controlNode, WebFormContainer container, string prefix=null)
		{
			var prependingTagNames = new string[] 
			{
				"asp:panel"
			};
			string newPrefix = prefix ?? string.Empty;
			if (controlNode.Attributes.ContainsKey("id"))
			{
				var controlItem = new WebFormServerControl
				{
					TagName = controlNode.TagName,
					ControlID = controlNode.Attributes["id"],
					Prefix = prefix
				};
				container.Controls.Add(controlItem);
				if (prependingTagNames.Contains(controlItem.TagName, StringComparer.CurrentCultureIgnoreCase))
				{
					newPrefix += controlItem.ControlID + "_";
				}
			}
			var childControlNodeList = controlNode.Children.Where(i=>i is ServerControlNode);
			foreach(ServerControlNode childControlNode in childControlNodeList)
			{
				this.LoadControl(childControlNode, container, newPrefix);
			}
		}