public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            _resourceFiles = new List <WebResourceFile>();
            //
            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          = string.Format(CultureInfo.InvariantCulture, "{0}px", _ftSize);
                string includeTime = IncludeTime ? "true" : "false";
                string cannotMove  = Movable ? "false" : "true";
                string pid         = (this.Parent is Form) ? "*" : (this.Parent.Site != null ? this.Parent.Site.Name : this.Parent.Name);
                XmlUtil.SetAttribute(node, "useDP", true);
                XmlUtil.SetAttribute(node, "useDPTime", includeTime);
                XmlUtil.SetAttribute(node, "useDPSize", fs);
                XmlUtil.SetAttribute(node, "useDPfix", cannotMove);
                XmlUtil.SetAttribute(node, "useDPid", pid);
                XmlUtil.SetAttribute(node, "useDPx", this.Left);
                XmlUtil.SetAttribute(node, "useDPy", this.Top);
                if (!_visible)
                {
                    XmlUtil.SetAttribute(node, "useDPv", true);
                }
            }
            StringBuilder style = new StringBuilder();

            WebPageCompilerUtility.CreateElementPosition(this, style, EnumWebElementPositionType.Auto);
            XmlUtil.SetAttribute(node, "style", style.ToString());

            //
            _visible = true;
            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)
                            {
                                _visible = false;
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
        }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            XmlElement tNode = node.OwnerDocument.CreateElement("legend");

            node.AppendChild(tNode);
            tNode.InnerText = this.Text;
            tNode.IsEmpty   = false;
            //
            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("; ");
                }
            }
            //
            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());
        }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            if (_resourceFiles == null)
            {
                _resourceFiles = new List <WebResourceFile>();
            }
            string[] jsFiles = new string[120];
            jsFiles[0]  = "go.gif";
            jsFiles[1]  = "go_inact.gif";
            jsFiles[2]  = "folder.gif";
            jsFiles[3]  = "resizer.gif";
            jsFiles[4]  = "newElement.png";
            jsFiles[5]  = "moveup.png";
            jsFiles[6]  = "movedown.png";
            jsFiles[7]  = "undo.png";
            jsFiles[8]  = "undo_inact.png";
            jsFiles[9]  = "redo.png";
            jsFiles[10] = "redo_inact.png";
            jsFiles[11] = "stopTag.png";
            jsFiles[12] = "stopTag_inact.png";
            jsFiles[13] = "expand_res.png";
            jsFiles[14] = "expand_min.png";
            jsFiles[15] = "cancel.png";
            //
            jsFiles[16] = "newAttr.png";
            jsFiles[17] = "removeTag.png";
            jsFiles[18] = "removeOutTag.png";
            jsFiles[19] = "vSep.png";
            jsFiles[20] = "resizeV.png";
            jsFiles[21] = "ok.png";
            jsFiles[22] = "save.png";
            jsFiles[23] = "reset.png";
            jsFiles[24] = "space.png";
            jsFiles[25] = "tglProp.png";
            jsFiles[26] = "elementLocator.png";
            jsFiles[27] = "redbox.png";
            //
            jsFiles[28] = "validate.png";
            jsFiles[29] = "addmeta.png";
            jsFiles[30] = "addscript.png";
            jsFiles[31] = "addcss.png";
            jsFiles[32] = "addlink.png";
            jsFiles[33] = "tableHead.png";
            jsFiles[34] = "tableFoot.png";
            jsFiles[35] = "addthead.png";
            jsFiles[36] = "addtfoot.png";
            jsFiles[37] = "html_col.png";
            jsFiles[38] = "newAbove.png";
            jsFiles[39] = "newBelow.png";
            //
            jsFiles[40] = "newLeft.png";
            jsFiles[41] = "newRight.png";
            jsFiles[42] = "mergeLeft.png";
            jsFiles[43] = "mergeRight.png";
            jsFiles[44] = "mergeAbove.png";
            jsFiles[45] = "mergeBelow.png";
            jsFiles[46] = "splitH.png";
            jsFiles[47] = "splitV.png";
            jsFiles[48] = "html_img.png";
            jsFiles[49] = "newDefinition.png";
            jsFiles[50] = "newOptionGroup.png";
            jsFiles[51] = "html_h1.png";
            jsFiles[52] = "html_h2.png";
            jsFiles[53] = "html_h3.png";
            jsFiles[54] = "html_h4.png";
            jsFiles[55] = "html_h5.png";
            jsFiles[56] = "html_h6.png";
            //
            jsFiles[57] = "addarea.png";
            jsFiles[58] = "newlegend.png";
            jsFiles[59] = "addparam.png";
            jsFiles[60] = "moveleft.png";
            jsFiles[61] = "moveright.png";
            jsFiles[62] = "html_a.png";
            jsFiles[63] = "html_bdo.png";
            jsFiles[64] = "html_blockquote.png";
            jsFiles[65] = "html_button.png";
            jsFiles[66] = "html_checkbox.png";
            jsFiles[67] = "html_cite.png";
            jsFiles[68] = "html_code.png";
            jsFiles[69] = "html_dl.png";
            jsFiles[70] = "html_div.png";
            jsFiles[71] = "html_fieldset.png";
            jsFiles[72] = "html_file.png";
            //
            jsFiles[73] = "html_form.png";
            jsFiles[74] = "html_h.png";
            jsFiles[75] = "html_hr.png";
            jsFiles[76] = "html_hidden.png";
            jsFiles[77] = "html_iframe.png";
            jsFiles[78] = "html_a.png";
            jsFiles[79] = "html_input.png";
            jsFiles[80] = "html_kbd.png";
            jsFiles[81] = "html_label.png";
            jsFiles[82] = "html_br.png";
            jsFiles[83] = "html_ul.png";
            jsFiles[84] = "html_select.png";
            jsFiles[85] = "html_map.png";
            jsFiles[86] = "html_object.png";
            jsFiles[87] = "html_ol.png";
            jsFiles[88] = "html_p.png";
            //
            jsFiles[89]  = "html_password.png";
            jsFiles[90]  = "html_pre.png";
            jsFiles[91]  = "html_span.png";
            jsFiles[92]  = "html_radio.png";
            jsFiles[93]  = "html_reset.png";
            jsFiles[94]  = "html_samp.png";
            jsFiles[95]  = "html_submit.png";
            jsFiles[96]  = "html_table.png";
            jsFiles[97]  = "html_textarea.png";
            jsFiles[98]  = "html_var.png";
            jsFiles[99]  = "html_menu.png";
            jsFiles[100] = "html_treeview.png";
            jsFiles[101] = "html_embed.png";
            jsFiles[102] = "html_music.png";
            jsFiles[103] = "html_video.png";
            jsFiles[104] = "bold_act.png";
            //
            jsFiles[105] = "italic_act.png";
            jsFiles[106] = "underline_act.png";
            jsFiles[107] = "strikethrough_act.png";
            jsFiles[108] = "subscript_act.png";
            jsFiles[109] = "superscript_act.png";
            jsFiles[110] = "alignLeft.png";
            jsFiles[111] = "alignCenter.png";
            jsFiles[112] = "alignRight.png";
            jsFiles[113] = "indent.png";
            jsFiles[114] = "dedent.png";
            jsFiles[115] = "editor.png";
            //
            jsFiles[116] = "arrow.gif";
            jsFiles[117] = "cross.gif";
            jsFiles[118] = "hs.png";
            jsFiles[119] = "hv.png";
            //
            string btimg;
            string dir = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "libjs");

            for (int i = 0; i < jsFiles.Length; i++)
            {
                btimg = Path.Combine(dir, jsFiles[i]);
                if (File.Exists(btimg))
                {
                    bool b;
                    _resourceFiles.Add(new WebResourceFile(btimg, "libjs", out b));
                }
            }
            //
            StringBuilder sb = new StringBuilder();

            //
            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
                        {
                        }
                    }
                }
            }
            XmlUtil.SetAttribute(node, "style", sb.ToString());
            //
            XmlElement xe = (XmlElement)node;

            xe.IsEmpty = false;
        }
Example #4
0
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positiontype, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            _resourceFiles = new List <WebResourceFile>();
            _htmlParts     = new Dictionary <string, string>();

            foreach (Control ct in this.Controls)
            {
                createControlWebContents(ct, node, groupId);
            }
            //
            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("; ");
                }
            }
            //
            sb.Append("color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
            sb.Append("; ");
            //
            if (this.BorderStyle != BorderStyle.None)
            {
                sb.Append("border:1px solid black;");
            }
            //
            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());
        }
Example #5
0
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            XmlNode brNode = node.OwnerDocument.CreateElement("br");

            ((XmlElement)node).IsEmpty = false;
            node.AppendChild(brNode);
            if (_resourceFiles == null)
            {
                _resourceFiles = new List <WebResourceFile>();
            }
            //
            string[] jsFiles = new string[16];
            jsFiles[0]  = "empty_0.png";
            jsFiles[1]  = "empty_dn.png";
            jsFiles[2]  = "empty_up.png";
            jsFiles[3]  = "empty_up_dn.png";
            jsFiles[4]  = "h1.png";
            jsFiles[5]  = "l_up_dn.png";
            jsFiles[6]  = "minus_0.png";
            jsFiles[7]  = "minus_dn.png";
            jsFiles[8]  = "minus_up.png";
            jsFiles[9]  = "minus_up_dn.png";
            jsFiles[10] = "plus_0.png";
            jsFiles[11] = "plus_dn.png";
            jsFiles[12] = "plus_up.png";
            jsFiles[13] = "plus_up_dn.png";
            jsFiles[14] = "vl.png";
            jsFiles[15] = "w20.png";
            string btimg;
            string dir = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "webTreeView");

            for (int i = 0; i < jsFiles.Length; i++)
            {
                btimg = Path.Combine(dir, jsFiles[i]);
                if (File.Exists(btimg))
                {
                    bool b;
                    _resourceFiles.Add(new WebResourceFile(btimg, "treeview", out b));
                }
            }
            dir   = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "libjs");
            btimg = Path.Combine(dir, "html_file.png");
            if (File.Exists(btimg))
            {
                bool b;
                _resourceFiles.Add(new WebResourceFile(btimg, "libjs", out b));
            }
            //
            StringBuilder sb = new StringBuilder();

            //
            sb.Append("border-style:");
            sb.Append(_borderStyle);
            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());
        }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            for (int i = 0; i < Items.Count; i++)
            {
                string v;
                string s = VPLUtil.ObjectToString(Items[i]);
                if (!string.IsNullOrEmpty(s))
                {
                    int n = s.IndexOf('|');
                    if (n >= 0)
                    {
                        v = s.Substring(n + 1).Trim();
                        s = s.Substring(0, n).Trim();
                    }
                    else
                    {
                        v = s;
                    }
                }
                else
                {
                    v = string.Empty;
                }
                XmlElement oNode = node.OwnerDocument.CreateElement("option");
                node.AppendChild(oNode);
                XmlUtil.SetAttribute(oNode, "value", v);
                oNode.InnerText = s;
                oNode.IsEmpty   = false;
            }
            //
            if (Items.Count < 2)
            {
                XmlUtil.SetAttribute(node, "size", 2);
            }
            else
            {
                XmlUtil.SetAttribute(node, "size", Items.Count);
            }

            if (this.MultiSelection)
            {
                XmlUtil.SetAttribute(node, "multiple", "multiple");
            }
            //
            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());
            //
            StringBuilder dbs = new StringBuilder();

            if (this.DataBindings != null && this.DataBindings.Count > 0)
            {
                string tbl2    = null;
                string sIdx    = string.Empty;
                string slItem  = string.Empty;
                string slValue = string.Empty;
                for (int i = 0; i < DataBindings.Count; i++)
                {
                    if (DataBindings[i].DataSource != null)
                    {
                        if (string.Compare(DataBindings[i].PropertyName, "SelectedIndex", StringComparison.OrdinalIgnoreCase) == 0 || string.Compare(DataBindings[i].PropertyName, "selectedIndex", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            sIdx = string.Format(CultureInfo.InvariantCulture, "{0}:{1}:SelectedIndex",
                                                 DataBindings[i].BindingMemberInfo.BindingPath, DataBindings[i].BindingMemberInfo.BindingMember);
                        }
                        else if (string.Compare(DataBindings[i].PropertyName, "SelectedItem", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            tbl2   = DataBindings[i].BindingMemberInfo.BindingPath;
                            slItem = DataBindings[i].BindingMemberInfo.BindingField;                            // "SelectedItem";
                        }
                        else if (string.Compare(DataBindings[i].PropertyName, "SelectedValue", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            tbl2    = DataBindings[i].BindingMemberInfo.BindingPath;
                            slValue = DataBindings[i].BindingMemberInfo.BindingField;                             // "SelectedValue";
                        }
                    }
                }
                if (!string.IsNullOrEmpty(sIdx))
                {
                    dbs.Append(sIdx);
                }
                if (!string.IsNullOrEmpty(tbl2))
                {
                    if (dbs.Length > 0)
                    {
                        dbs.Append(";");
                    }
                    dbs.Append(tbl2);
                    dbs.Append(":");
                    dbs.Append(slItem);
                    dbs.Append(":");
                    dbs.Append(slValue);
                }
                if (dbs.Length > 0)
                {
                    XmlUtil.SetAttribute(node, "jsdb", dbs.ToString());
                }
                if (this.AddBlankOnDataBinding)
                {
                    XmlUtil.SetAttribute(node, "useblank", "true");
                }
            }
            if (this.Items.Count == 0)
            {
                node.InnerText = "";
            }
            XmlElement xe = (XmlElement)node;

            xe.IsEmpty = false;
        }
        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);
            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);
            }
        }
Example #9
0
        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");
            }
            if (!string.IsNullOrEmpty(_href))
            {
                XmlUtil.SetAttribute(node, "href", _href);
            }
            if (!string.IsNullOrEmpty(_target))
            {
                XmlUtil.SetAttribute(node, "target", _target);
            }
            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 && this.ForeColor != Color.Blue)
                {
                    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));
                //
            }
            XmlUtil.SetAttribute(node, "style", sb.ToString());
            //
            WebPageCompilerUtility.WriteDataBindings(node, this.DataBindings, DataBindNameMap);
            //
        }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            if (File.Exists(_filepath))
            {
                bool            b;
                WebResourceFile wf = new WebResourceFile(_filepath, WebResourceFile.WEBFOLDER_Images, out b);
                _resourceFiles.Add(wf);
            }
            XmlUtil.SetAttribute(node, "type", "button");
            XmlUtil.SetAttribute(node, "value", this.Text.Replace("\r", "").Replace('\n', ' '));
            //
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            //
            StringBuilder sb = new StringBuilder();

            //
            sb.Append("white-space: normal;");
            //
            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());
        }
        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);
        }