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) { XmlUtil.SetAttribute(node, "tabindex", this.TabIndex); WebPageCompilerUtility.SetWebControlAttributes(this, node); XmlNode pNode; StringBuilder sb; string id = XmlUtil.GetAttribute(node, "id"); if (string.IsNullOrEmpty(id)) { id = CodeName; } XmlUtil.SetAttribute(node, "id", string.Format(CultureInfo.InvariantCulture, "{0}sp", id)); XmlUtil.RemoveAttribute(node, "name"); sb = new StringBuilder(); WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb); WebPageCompilerUtility.CreateElementPosition(this, sb, positionType); if (_dataNode != null) { 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()); // XmlNode chkNode = node.OwnerDocument.CreateElement("input"); node.AppendChild(chkNode); XmlUtil.SetAttribute(chkNode, "id", id); //XmlUtil.SetAttribute(chkNode, "name", CodeName); XmlUtil.SetAttribute(chkNode, "type", "checkbox"); XmlUtil.SetAttribute(chkNode, "value", this.Value); if (this.Checked) { XmlUtil.SetAttribute(chkNode, "checked", this.Checked); } WebPageCompilerUtility.WriteDataBindings(chkNode, this.DataBindings, DataBindNameMap1); sb = new StringBuilder(); if (_dataNode != null) { 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 { bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture); if (b) { XmlUtil.SetAttribute(chkNode, "disabled", "disabled"); } } catch { } } } } WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false); string st = sb.ToString(); if (st.Length > 0) { XmlUtil.SetAttribute(chkNode, "style", st); } { XmlElement tn = node.OwnerDocument.CreateElement("span"); tn.InnerText = this.Text; tn.IsEmpty = false; XmlUtil.SetAttribute(tn, "id", string.Format(CultureInfo.InvariantCulture, "{0}tx", id)); WebPageCompilerUtility.WriteDataBindings(tn, this.DataBindings, DataBindNameMap2); // 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("; "); } } // sb.Append("color:"); sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor)); sb.Append("; "); // WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, true); // XmlUtil.SetAttribute(tn, "style", sb.ToString()); node.InsertAfter(tn, chkNode); } }
public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId) { OnSetType(node); XmlUtil.SetAttribute(node, "tabindex", this.TabIndex); WebPageCompilerUtility.SetWebControlAttributes(this, node); if (IncludeDatetimePickerButton) { bool b; string btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "datepicker.css"); if (File.Exists(btimg)) { _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Css, out b)); } string[] jsFiles = new string[8]; jsFiles[0] = "backstripes.gif"; jsFiles[1] = "bg_header.jpg"; jsFiles[2] = "bullet1.gif"; jsFiles[3] = "bullet2.gif"; jsFiles[4] = "cal.gif"; jsFiles[5] = "cal-grey.gif"; jsFiles[6] = "datepicker.js"; jsFiles[7] = "gradient-e5e5e5-ffffff.gif"; for (int i = 0; i < jsFiles.Length; i++) { btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), jsFiles[i]); if (File.Exists(btimg)) { _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Javascript, out b)); } } bool inDataRepeater = false; Control p = this.Parent; while (p != null) { if (p is HtmlDataRepeater) { inDataRepeater = true; break; } p = p.Parent; } if (inDataRepeater) { string fs = "10px"; if (!string.IsNullOrEmpty(this.DatetimePickerFontSize)) { fs = DatetimePickerFontSize.Trim(); if (fs.Length == 0) { fs = "10px"; } } string includeTime = DatetimePickerIncludeTime ? "true" : "false"; XmlUtil.SetAttribute(node, "useDP", true); XmlUtil.SetAttribute(node, "useDPTime", includeTime); XmlUtil.SetAttribute(node, "useDPSize", fs); } } if (this.ReadOnly) { XmlUtil.SetAttribute(node, "readonly", "true"); } if (this.MaxLength > 0 && this.MaxLength < int.MaxValue) { XmlUtil.SetAttribute(node, "maxlength", this.MaxLength.ToString(CultureInfo.InvariantCulture)); } // StringBuilder sb = new StringBuilder(); // sb.Append("background-color:"); sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor)); sb.Append("; "); // sb.Append("color:"); sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor)); 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)); // 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 { bool 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); }
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); }