Example #1
0
        protected override void Render(HtmlTextWriter writer)
        {
            AddAttributesToRender(writer);

            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            lblOldPassword.RenderControl(writer);
            tbOldPassword.RenderControl(writer);
            rfvOldPassword.RenderControl(writer);
            cvOldPassword.RenderControl(writer);

            lblNewPassword.RenderControl(writer);
            tbNewPassword.RenderControl(writer);
            rfvNewPassword.RenderControl(writer);

            lblRepeatNewPassword.RenderControl(writer);
            tbRepeatNewPassword.RenderControl(writer);
            rfvRepeatNewPassword.RenderControl(writer);
            cvRepeatNewPassword.RenderControl(writer);

            lbtnSubmitButton.Attributes.Add("class", "password-change-button cancel");
            lbtnSubmitButton.RenderControl(writer);

            writer.RenderEndTag();
        }
Example #2
0
        /// <summary>
        /// Displays the control on the client.
        /// </summary>
        /// <param name="writer">A <see cref="T:System.Web.UI.HtmlTextWriter"></see> that contains the output stream for rendering on the client.</param>
        protected override void Render(HtmlTextWriter writer)
        {
            if (this.rangeValidator != null)
            {
                rangeValidator.RenderControl(writer);
            }

            if (this.requiredFieldValidator != null)
            {
                requiredFieldValidator.RenderControl(writer);
            }

            if (this.compareValidator != null)
            {
                compareValidator.RenderControl(writer);
            }

            if (this.regularExpressionValidator != null)
            {
                regularExpressionValidator.RenderControl(writer);
            }

            if (this.customStringLengthValidator != null)
            {
                customStringLengthValidator.RenderControl(writer);
            }
        }
Example #3
0
        protected override void Render(HtmlTextWriter w)
        {
            textBox.RenderControl(w);
            extender.RenderControl(w);

            if (this.EnableValidation)
            {
                validator.RenderControl(w);
            }
        }
 static public void WriteCompareValidator(HtmlTextWriter writer, CompareValidator cv, string className, string controlToValidate, string msg, string controlToCompare)
 {
     if (cv != null)
     {
         cv.CssClass          = className;
         cv.ControlToValidate = controlToValidate;
         cv.ErrorMessage      = msg;
         cv.ControlToCompare  = controlToCompare;
         cv.RenderControl(writer);
     }
 }
Example #5
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            base.Render(writer);

            if (Required)
                requiredFieldValidator.RenderControl(writer);

            if (Required && !string.IsNullOrEmpty(PlaceHolderText))
                compareValidator.RenderControl(writer);

            var css = new StringBuilder();
            writer.AddAttribute(HtmlTextWriterAttribute.Type, "text/css");
            writer.AddAttribute(HtmlTextWriterAttribute.Rel, "stylesheet");
            writer.RenderBeginTag(HtmlTextWriterTag.Style);
            css.AppendFormat("#{0}.placeholder {{ color: {1}; }}", this.ClientID, PlaceHolderColor);
            writer.Write(css.ToString());
            writer.RenderEndTag();
            writer.WriteLine();

            var sm = ScriptManager.GetCurrent(Page);
            var js = new StringBuilder();
            js.AppendFormat("if (document.getElementById('{0}').addEventListener) {{ document.getElementById('{0}').addEventListener('focus', function () {{ if (this.value == '{1}') {{ this.value = ''; this.className = this.className.replace(/placeholder/g, ''); }} }}, false); }} else if (document.getElementById('{0}').attachEvent) {{ document.getElementById('{0}').attachEvent('onfocus', function () {{ if (document.getElementById('{0}').value == '{1}') {{ document.getElementById('{0}').value = ''; document.getElementById('{0}').className = document.getElementById('{0}').className.replace(/placeholder/g, ''); }} }}); }}", this.ClientID, PlaceHolderText);
            js.AppendFormat("if (document.getElementById('{0}').addEventListener) {{ document.getElementById('{0}').addEventListener('blur', function () {{ if (this.value == '') {{ this.value = '{1}'; this.className = this.className + ' placeholder '; }} }}, false); }} else if (document.getElementById('{0}').attachEvent) {{ document.getElementById('{0}').attachEvent('onblur', function () {{ if (document.getElementById('{0}').value == '') {{ document.getElementById('{0}').value = '{1}'; document.getElementById('{0}').className = document.getElementById('{0}').className + ' placeholder '; }} }}); }}", this.ClientID, PlaceHolderText);

            if (sm != null && sm.IsInAsyncPostBack)
            {
                if (!string.IsNullOrEmpty(PlaceHolderText))
                    ScriptManager.RegisterStartupScript(Page, typeof(TextBoxExt), UniqueID, js.ToString(), true);
            }
            else
            {
                if (!string.IsNullOrEmpty(PlaceHolderText))
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Type, "text/javascript");
                    writer.RenderBeginTag(HtmlTextWriterTag.Script);
                    writer.Write(js.ToString());
                    writer.RenderEndTag();
                    writer.WriteLine();
                }
            }
        }