public void OnWebPageLoaded(StringCollection sc)
 {
     if (IncludeDatetimePickerButton)
     {
         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";
             sc.Add(string.Format(CultureInfo.InvariantCulture,
                                  "JsonDataBinding.CreateDatetimePickerForTextBox('{0}','{1}',{2});\r\n",
                                  this.CodeName, fs, includeTime));
         }
     }
 }
        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);
        }