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()); // }
public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId) { XmlUtil.SetAttribute(node, "tabindex", this.TabIndex); WebPageCompilerUtility.SetWebControlAttributes(this, node); if (this.RightToLeft == RightToLeft.Yes) { XmlUtil.SetAttribute(node, "dir", "RTL"); } WebPageCompilerUtility.SetTextContentsToNode(node, this.Text); // 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("; "); } } // if (this.Parent != null) { if (this.ForeColor != this.Parent.ForeColor) { sb.Append("color:"); sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor)); sb.Append("; "); } } // if (_float != EnumInlineFloat.none && positionType == EnumWebElementPositionType.Absolute) { sb.Append("float:"); sb.Append(_float.ToString()); sb.Append("; "); 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("%; "); } } } // WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb); WebPageCompilerUtility.CreateElementPosition(this, sb, positionType); WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false); // if (_dataNode != null) { XmlNode pNode = _dataNode.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 { } } } sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font)); // } XmlUtil.SetAttribute(node, "style", sb.ToString()); // WebPageCompilerUtility.WriteDataBindings(node, this.DataBindings, DataBindNameMap); // }
public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId) { bool b; XmlUtil.SetAttribute(node, "tabindex", this.TabIndex); WebPageCompilerUtility.SetWebControlAttributes(this, node); _resourceFiles = new List <WebResourceFile>(); if (File.Exists(_filepath)) { WebResourceFile wf = new WebResourceFile(_filepath, WebResourceFile.WEBFOLDER_Images, out b); _resourceFiles.Add(wf); if (b) { _filepath = wf.ResourceFile; } XmlUtil.SetAttribute(node, "src", string.Format(CultureInfo.InvariantCulture, "{0}/{1}", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(_filepath))); } if (!string.IsNullOrEmpty(Description)) { XmlUtil.SetAttribute(node, "alt", Description); } if (!string.IsNullOrEmpty(MouseOverText)) { XmlUtil.SetAttribute(node, "title", MouseOverText); } // StringBuilder sb = new StringBuilder(); // if (ImageSizeMode == EnumHtmlImageSizeMode.Stretch) { 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("%; "); } } } // WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb); WebPageCompilerUtility.CreateElementPosition(this, sb, positionType); WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false); // if (_dataNode != null) { XmlNode pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture, "{0}[@name='Visible']", XmlTags.XML_PROPERTY)); if (pNode != null) { string s = pNode.InnerText; if (!string.IsNullOrEmpty(s)) { try { b = Convert.ToBoolean(s, CultureInfo.InvariantCulture); if (!b) { sb.Append("display:none; "); } } catch { } } } sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font)); // pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture, "{0}[@name='disabled']", XmlTags.XML_PROPERTY)); if (pNode != null) { string s = pNode.InnerText; if (!string.IsNullOrEmpty(s)) { try { b = Convert.ToBoolean(s, CultureInfo.InvariantCulture); if (b) { XmlUtil.SetAttribute(node, "disabled", "disabled"); } } catch { } } } } XmlUtil.SetAttribute(node, "style", sb.ToString()); // WebPageCompilerUtility.WriteDataBindings(node, this.DataBindings, DataBindNameMap); }