//======================================================================================================== #endregion #endregion #region private methods private void createControlWebContents(Control ct, XmlNode parentNode, int groupId) { XmlNode nodeNext = parentNode; IWebClientControl webc = ct as IWebClientControl; if (webc != null) { XmlNode nd = parentNode.OwnerDocument.CreateElement(webc.ElementName); parentNode.AppendChild(nd); XmlUtil.SetAttribute(nd, "id", webc.CodeName); webc.CreateHtmlContent(nd, EnumWebElementPositionType.Auto, groupId); WebPageCompilerUtility.CreateElementAnchor(webc, nd); _resourceFiles.AddRange(webc.GetResourceFiles()); Dictionary <string, string> hp = webc.HtmlParts; if (hp != null && hp.Count > 0) { foreach (KeyValuePair <string, string> kv in hp) { _htmlParts.Add(kv.Key, kv.Value); } } nodeNext = nd; } IWebPageLayout lt = ct as IWebPageLayout; if (lt == null) { foreach (Control c in ct.Controls) { createControlWebContents(c, nodeNext, groupId); } } }
public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId) { string idCust = string.Format(CultureInfo.InvariantCulture, "c{0}", Guid.NewGuid().GetHashCode().ToString("x", CultureInfo.InvariantCulture)); XmlUtil.SetAttribute(node, "tabindex", this.TabIndex); WebPageCompilerUtility.SetWebControlAttributes(this, node); XmlUtil.SetAttribute(node, "action", _serverPage); XmlUtil.SetAttribute(node, "method", "post"); XmlUtil.SetAttribute(node, "enctype", "multipart/form-data"); XmlUtil.SetAttribute(node, HtmlFileUpload.HIDDENRequest, idCust); // XmlNode jsonNode = node.OwnerDocument.CreateElement("input"); node.AppendChild(jsonNode); XmlUtil.SetAttribute(jsonNode, "type", "hidden"); XmlUtil.SetAttribute(jsonNode, "id", idCust); XmlUtil.SetNameAttribute(jsonNode, HtmlFileUpload.HIDDENRequest); // string ifId = HtmlFileUploadGroup.CreateIFrame(node); XmlUtil.SetAttribute(node, "target", ifId); // StringBuilder sb = new StringBuilder(); if (this.Parent != null) { if (this.BackColor != this.Parent.BackColor) { sb.Append("background-color:"); sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor)); sb.Append("; "); } } IWebPageLayout wl = this.Parent as IWebPageLayout; if (wl != null) { sb.Append("width:100%; height:100%; "); } else { if (WidthType != SizeType.AutoSize) { sb.Append("width:"); if (WidthType == SizeType.Absolute) { sb.Append(Width.ToString(CultureInfo.InvariantCulture)); sb.Append("px; "); } else { sb.Append(WidthInPercent.ToString(CultureInfo.InvariantCulture)); sb.Append("%; "); } } // if (HeightType != SizeType.AutoSize) { sb.Append("height:"); if (HeightType == SizeType.Absolute) { sb.Append(Height.ToString(CultureInfo.InvariantCulture)); sb.Append("px; "); } else { sb.Append(HeightInPercent.ToString(CultureInfo.InvariantCulture)); sb.Append("%; "); } } } sb.Append("border: solid 1px #40a0c0;"); if (_xmlNode != null) { XmlNode pNode = _xmlNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture, "{0}[@name='Visible']", XmlTags.XML_PROPERTY)); if (pNode != null) { string s = pNode.InnerText; if (!string.IsNullOrEmpty(s)) { try { bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture); if (!b) { sb.Append("display:none; "); } } catch { } } } } WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb); WebPageCompilerUtility.CreateElementPosition(this, sb, positionType); WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false); XmlUtil.SetAttribute(node, "style", sb.ToString()); // }