protected override void RenderContents(HtmlTextWriter writer)
        {
            const string MouseTemplate   = "onmousedown=\"return onButtonClick_dp_opgeek ('{0}', this);\" onclick=\"return false\"";
            const string ControlTemplate = "<input type=\"text\" name=\"{0}Display\" id=\"{0}Display\" size=\"18\" value=\"\" {5}readonly/><img align=\"absbottom\" vspace=\"1\" border=\"2\" id=\"{0}Icon\" name=\"{0}Icon\" src=\"{2}DatePickerIcon.gif\" width=\"19\" height=\"19\" {6}><input type=\"hidden\" class=\"DateBox_dp_opgeek\" name=\"{0}\" id=\"{0}\" value=\"{1}\"/><script type=\"text/javascript\">\n\tinitialize_dp_opgeek ('{0}', '{1}', true, '{7}', {3}, {4});\n</script>\n";

            string disableCode = String.Empty;
            string mouseHtml   = String.Empty;

            if (!Enabled)
            {
                disableCode = "disabled=\"disabled\" ";
            }
            else
            {
                mouseHtml = String.Format(Globalisation.GetCultureInfo(), MouseTemplate, ClientID);
            }

            string value = String.Empty;

            if (!IsEmpty)
            {
                value = Normaliser.GetOdbcFormatFromDate(Value);
            }

            string controlHtml = String.Format(Globalisation.GetCultureInfo(), ControlTemplate, ClientID, value, GetIconUrl(), FirstYear, LastYear, disableCode, mouseHtml, DisplayFormat);

            writer.Write(controlHtml);

            return;
        }
        protected override void RenderContents(HtmlTextWriter htwOutput)
        {
            const string MouseTemplate    = "onmousedown=\"return onButtonDown_dp_opgeek ('{0}Icon');\" onmouseup=\"return onButtonUp_dp_opgeek ('{0}Icon');\" onmouseout=\"return onButtonUp_dp_opgeek ('{0}Icon');\" onclick=\"return onButtonClick_dp_opgeek ('{0}');\"";
            const string ControlTemplate  = "\n<div class=\"DatePicker_dp_opgeek\" id=\"{0}DatePicker_dp_opgeek\"></div><input type=\"text\" style=\"{3}{9}\" name=\"{0}Display\" id=\"{0}Display\" size=\"18\" value=\"\" {6}readonly/><img id=\"{0}Icon\" src=\"{2}\" width=\"{11}\" height=\"{10}\" {7} style=\"margin-bottom: -3px; background-color: menu; border-width: 1px; border-style: outset;\"><input type=\"hidden\" class=\"DateBox_dp_opgeek\" name=\"{0}\" id=\"{0}\" value=\"{1}\"/><script type=\"text/javascript\">\n\tinitialize_dp_opgeek ('{0}', true, '{8}', {4}, {5});\n</script>\n";
            string       backgroundColour = String.Empty;

            if (!ControlStyle.BackColor.IsEmpty)
            {
                backgroundColour = "background-color: " + String.Format(Globalisation.GetCultureInfo(), "#{0:x2}{1:x2}{2:x2}", ControlStyle.BackColor.R, ControlStyle.BackColor.G, ControlStyle.BackColor.B) + "; ";
            }

            string disableCode = String.Empty;
            string mouseHtml   = String.Empty;

            if (!Enabled)
            {
                disableCode = "disabled=\"disabled\" ";
            }
            else
            {
                mouseHtml = String.Format(Globalisation.GetCultureInfo(), MouseTemplate, ClientID);
            }

            string value = String.Empty;

            if (!IsEmpty)
            {
                value = Normaliser.GetOdbcFormatFromDate(Value);
            }

            string boxWidth = String.Empty;

            if ((!Width.IsEmpty) && (Width.Type == UnitType.Pixel))
            {
                int iWidth = (int)Width.Value - DatePickerConstants.ButtonWidth - 3;
                if (iWidth > 0)
                {
                    boxWidth = "width: " + iWidth + "px; ";
                }
                else
                {
                    boxWidth = "display: none;";
                }
            }

            string boxHeight = String.Empty;

            if ((!Height.IsEmpty) && (Height.Type == UnitType.Pixel))
            {
                boxHeight = "height: " + (Height.Value - DatePickerConstants.ButtonHeight - 3) + "px; ";
            }

            string boxSize = boxHeight + boxWidth;

            string controlHtml = String.Format(Globalisation.GetCultureInfo(), ControlTemplate, ClientID, value, GetIconUrl(), backgroundColour, FirstYear, LastYear, disableCode, mouseHtml, DisplayFormat, boxSize, DatePickerConstants.ButtonHeight, DatePickerConstants.ButtonWidth);

            htwOutput.Write(controlHtml);

            return;
        }
예제 #3
0
        protected override void RenderContents(HtmlTextWriter writer)
        {
            const string MouseTemplate   = "onmousedown=\"return onButtonDown_dp_opgeek ('{0}Icon');\" onmouseup=\"return onButtonUp_dp_opgeek ('{0}Icon');\" onmouseout=\"return onButtonUp_dp_opgeek ('{0}Icon');\" onclick=\"return onButtonClick_dp_opgeek ('{0}');\"";
            const string ControlTemplate = "<span class=\"DatePicker_dp_opgeek\" id=\"{0}DatePicker_dp_opgeek\" style=\"position: absolute; display:\"></span><input type=\"text\" style=\"background-color: menu; font-size: 8pt; padding-top: 4; padding-left: 2;{8}\" name=\"{0}Display\" id=\"{0}Display\" size=\"18\" value=\"\" {5}readonly/><img id=\"{0}Icon\" name=\"{0}Icon\" src=\"{2}DatePickerIcon.gif\" width=\"{9}\" height=\"{10}\" valign=\"bottom\" {6} style=\"vertical-align: bottom; background-color: menu; border-width: 2px; border-style: outset;\"><input type=\"hidden\" class=\"DateBox_dp_opgeek\" name=\"{0}\" id=\"{0}\" value=\"{1}\"/><script type=\"text/javascript\">\n\tinitialize_dp_opgeek ('{0}', '{1}', true, '{7}', {3}, {4});\n</script>\n";

            string disableCode = String.Empty;
            string mouseHtml   = String.Empty;

            if (!Enabled)
            {
                disableCode = "disabled=\"disabled\" ";
            }
            else
            {
                mouseHtml = String.Format(Globalisation.GetCultureInfo(), MouseTemplate, ClientID);
            }

            string value = String.Empty;

            if (!IsEmpty)
            {
                value = Normaliser.GetOdbcFormatFromDate(Value);
            }

            string boxWidth = String.Empty;

            if ((!Width.IsEmpty) && (Width.Type == UnitType.Pixel))
            {
                int iWidth = (int)Width.Value - DatePickerConstants.ButtonWidth - 3;
                if (iWidth > 0)
                {
                    boxWidth = "width: " + iWidth + "px; ";
                }
                else
                {
                    boxWidth = "display: none;";
                }
            }

            string boxHeight = String.Empty;

            if ((!Height.IsEmpty) && (Height.Type == UnitType.Pixel))
            {
                boxHeight = "height: " + (Height.Value - DatePickerConstants.ButtonHeight - 3) + "px; ";
            }

            string boxSize = boxHeight + boxWidth;

            string controlHtml = String.Format(Globalisation.GetCultureInfo(), ControlTemplate, ClientID, value, GetIconUrl(), FirstYear, LastYear, disableCode, mouseHtml, DisplayFormat, boxSize, DatePickerConstants.ButtonHeight, DatePickerConstants.ButtonWidth);

            writer.Write(controlHtml);

            return;
        }