示例#1
0
        protected override void Render(HtmlTextWriter writer)
        {
            AddAttributesToRender(writer);
            if (CaptionAlign == AlignType.Top)
            {
                writer.Write("<span id=" + inputTextBox.ClientID + ">");
                captionLiteral.RenderControl(writer);
                writer.WriteBreak();
                if (DataType != InputType.None)
                {
                    inputTextBox.CausesValidation = true;
                }

                if (DataType == InputType.Date)
                {
                    inputTextBox.CssClass = "datepicker";
                }
                inputTextBox.RenderControl(writer);
                EnsureChildControls();
                if (DataType != InputType.None)
                {
                    reqValidator.ValidationGroup = inputTextBox.ValidationGroup;
                    reqValidator.RenderControl(writer);
                }
                if (DataType == InputType.Date)
                {
                    regValidator.ValidationGroup = inputTextBox.ValidationGroup;
                    regValidator.RenderControl(writer);
                }
                writer.Write("</span>");
            }
            else
            {
                writer.Write("<span id=" + inputTextBox.ClientID + ">");
                captionLiteral.RenderControl(writer);
                writer.Write("&nbsp;");
                inputTextBox.RenderControl(writer);
                if (DataType != InputType.None)
                {
                    reqValidator.ValidationGroup = inputTextBox.ValidationGroup;
                    reqValidator.RenderControl(writer);
                }
                if (DataType == InputType.Date)
                {
                    inputTextBox.CssClass        = "datepicker";
                    regValidator.ValidationGroup = inputTextBox.ValidationGroup;
                    regValidator.RenderControl(writer);
                }
                writer.Write("</span>");
            }
        }
示例#2
0
        protected override void Render(HtmlTextWriter writer)
        {
            // base.Render(writer);
            AddAttributesToRender(writer);

            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "1", false);
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            namelbl.RenderControl(writer);

            writer.RenderEndTag();
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            nameTextbox.RenderControl(writer);
            writer.RenderEndTag();
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            nameValidator.RenderControl(writer);

            writer.RenderEndTag();
            writer.RenderEndTag();

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            emaillbl.RenderControl(writer);
            writer.RenderEndTag();
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            emailTextbox.RenderControl(writer);
            writer.RenderEndTag();
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            emailValidator.RenderControl(writer);
            emailEV.RenderControl(writer);
            writer.RenderEndTag();
            writer.RenderEndTag();

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            phonelbl.RenderControl(writer);
            writer.RenderEndTag();
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            phoneTextbox.RenderControl(writer);
            writer.RenderEndTag();
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            phoneEV.RenderControl(writer);
            writer.RenderEndTag();
            writer.RenderEndTag();

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2", false);
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "right", false);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            submitButton.RenderControl(writer);
            writer.RenderEndTag();
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("&nbsp;");
            writer.RenderEndTag();
            writer.RenderEndTag();

            writer.RenderEndTag();
        }
示例#3
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);
            }
        }
示例#4
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();
        }
示例#5
0
        protected override void Render(HtmlTextWriter writer)
        {
            AddAttributesToRender(writer);

            if (base.ControlMode == SPControlMode.Display)
            {
                ctrl_Label.RenderControl(writer); // <label/>
            }
            else
            {
                ListControl listCtrl = this.ControlByType;
                if (listCtrl != null)
                {
                    listCtrl.RenderControl(writer); // <listInput/>
                    if (Field.Required)
                    {
                        if (ctrl_CheckList == null)
                        {
                            ctrl_ChoiceValidator.RenderControl(writer); // <validator/>
                        }
                        else
                        {
                            ctrl_ChoiceValidatorForListBox.RenderControl(writer); // <validator/>
                        }
                    }
                }
            }
        }
 protected override void Render(HtmlTextWriter writer)
 {
     AddAttributesToRender(writer);
     if (Field == null)
     {
         return;
     }
     if (Field.ReadOnly || (ControlMode == SPControlMode.Display))
     {
         ctrl_Label.RenderControl(writer); // <label/>
     }
     else
     {
         m_dropList.RenderControl(writer); // <select/>
         if (Field != null && Field.Required)
         {
             ctrl_TexboxValidator.RenderControl(writer); // <validator/>
         }
         var clientName = m_dropList.ClientID.Replace("_" + m_dropList.ID, "") + "_" + m_dropList.ID;
         writer.Write("<script type=\"text/javascript\">");
         writer.Write(GetJsScript(clientName, fld_Value.ID, RestService));
         writer.Write("</script>");
     }
     fld_Value.RenderControl(writer);
 }
示例#7
0
 /// <summary>
 /// Renders the required validator.
 /// </summary>
 /// <param name="writer">The writer.</param>
 protected void RenderRequiredValidator(HtmlTextWriter writer)
 {
     if (Required && !ReadOnly)
     {
         requiredValidator.Enabled = true;
         requiredValidator.RenderControl(writer);
     }
 }
示例#8
0
        protected override void Render(HtmlTextWriter writer)
        {
            AddAttributesToRender(writer);

            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding,
                                "1", false);
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            if (_buttonStyle != null)
            {
                submitButton.ApplyStyle(ButtonStyle);
            }

            if (_textBoxStyle != null)
            {
                nameTextBox.ApplyStyle(TextBoxStyle);
                emailTextBox.ApplyStyle(TextBoxStyle);
            }

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            nameLabel.RenderControl(writer);
            writer.RenderEndTag();  // Closing td.
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            nameTextBox.RenderControl(writer);
            writer.RenderEndTag();  //Closing td.
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            _nameValidator.RenderControl(writer);
            writer.RenderEndTag();  //Closing td.
            writer.RenderEndTag();  //Closing tr.

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            emailLabel.RenderControl(writer);
            writer.RenderEndTag();  //Closing td.
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            emailTextBox.RenderControl(writer);
            writer.RenderEndTag();  //Closing td.
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            _emailValidator.RenderControl(writer);
            writer.RenderEndTag();  //Closing td.
            writer.RenderEndTag();  //Closing tr.

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute(HtmlTextWriterAttribute.Colspan,
                                "2", false);
            writer.AddAttribute(HtmlTextWriterAttribute.Align,
                                "right", false);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            submitButton.RenderControl(writer);
            writer.RenderEndTag();  //closing td.
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("&nbsp;");
            writer.RenderEndTag();  //closing td.
            writer.RenderEndTag();  //closing tr.

            writer.RenderEndTag();  //closing table.
        }
示例#9
0
/* ------------------------------------------------------------------------
 * second to last stage of Page processing; Page object calls method on
 * control to write out control's markup to sent to browser.
 * ------------------------------------------------------------------------
 */
        protected override void Render(HtmlTextWriter w)
        {
            if (_label != null)
            {
                if (required)
                {
                    _label = ControlFactory.REQUIRED_FLAG + _label;
                }
                w.Write(ControlFactory.DIV_LABEL_FORMAT, ClientID, _label);
            }
// for client-side validation
            w.Write("<span>");

/*
 * must add at this stage in the Page life cycle to allow
 * setting 'required' flag on/off!
 *
 * HTML 'class' attribute, for client-side validation;
 */

/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 * control has extra class attributes compared to OTHER CONTROLS IN PROJECT
 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 */
            if (required)
            {
                classAttributes += ControlFactory.CHECKBOX_CLASS;
                //classAttributes += " " + ControlFactory.LIST_MULTIPLE_REQUIRED_CLASS
                // + " " + ControlFactory.REQUIRED_ATTR
                //;
                w.AddAttribute(ControlFactory.REQUIRED_ATTR, null);
            }
            if (EnableJavaScriptCheckAll)
            {
                classAttributes += " " + ControlFactory.CHECKBOXLIST_CHECKALL_CLASS;
            }
// server-side error highlighting
            if (Page.IsPostBack && _rfv != null && !_rfv.IsValid)
            {
                classAttributes += " " + ControlFactory.ERROR_CLASS;
                ControlFactory.AddServerRequiredStyle(w);
            }
// HTML class attribute(s)
            if (!string.IsNullOrEmpty(classAttributes))
            {
                w.AddAttribute(HtmlTextWriterAttribute.Class, ClassAttributes);
            }

            base.Render(w);

// server-side validator
            if (required && _rfv != null)
            {
                _rfv.RenderControl(w);
            }
            w.Write("</span>");
        }
 static public void WriteRequiredFieldValidator(HtmlTextWriter writer, RequiredFieldValidator rfv, string className, string controlToValidate, string msg)
 {
     if (rfv != null)
     {
         rfv.CssClass          = className;
         rfv.ControlToValidate = controlToValidate;
         rfv.ErrorMessage      = msg;
         rfv.RenderControl(writer);
     }
 }
示例#11
0
/* ------------------------------------------------------------------------
 * second to last stage of Page processing; Page object calls method on
 * control to write out control's markup to sent to browser.
 * ------------------------------------------------------------------------
 */
        protected override void Render(HtmlTextWriter w)
        {
            if (_label != null)
            {
                if (required)
                {
                    _label = ControlFactory.REQUIRED_FLAG + _label;
                }
                w.Write(ControlFactory.DIV_LABEL_FORMAT, ClientID, _label);
            }
// for client-side validation
            w.Write("<span>");

/*
 * must add at this stage in the Page life cycle to allow
 * setting 'required' flag on/off!
 *
 * HTML 'class' attribute, for client-side validation;
 */
            if (required)
            {
                classAttributes += " " + ControlFactory.RADIOBUTTONLIST_CLASS;

/*
 + " "
 +  ControlFactory.REQUIRED_ATTR;
 */
                w.AddAttribute(ControlFactory.REQUIRED_ATTR, null);
            }
// server-side error highlighting
            if (Page.IsPostBack && _rfv != null && !_rfv.IsValid)
            {
                classAttributes += " " + ControlFactory.ERROR_CLASS;
                ControlFactory.AddServerRequiredStyle(w);
            }
// HTML class attribute(s)
            if (!string.IsNullOrEmpty(classAttributes))
            {
                w.AddAttribute(HtmlTextWriterAttribute.Class, ClassAttributes);
            }

            base.Render(w);
// server-side validator
            if (required && _rfv != null)
            {
                _rfv.RenderControl(w);
            }
            w.Write("</span>");
        }
示例#12
0
        /// <summary>
        /// Renders a label and <see cref="T:System.Web.UI.WebControls.TextBox"/> control to the specified <see cref="T:System.Web.UI.HtmlTextWriter"/> object.
        /// </summary>
        /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter"/> that receives the rendered output.</param>
        protected override void Render(HtmlTextWriter writer)
        {
            bool isValid = !Required || requiredFieldValidator.IsValid;

            writer.AddAttribute("class", "control-group" +
                                (isValid ? "" : " error") +
                                (Required ? " required" : ""));
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            label.AddCssClass("control-label");
            label.RenderControl(writer);

            writer.AddAttribute("class", "controls");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            base.Render(writer);

            if (Required)
            {
                requiredFieldValidator.Enabled      = true;
                requiredFieldValidator.ErrorMessage = LabelText + " is Required.";
                requiredFieldValidator.RenderControl(writer);
            }

            if (Tip.Trim() != string.Empty)
            {
                writer.AddAttribute("class", "help-tip");
                writer.AddAttribute("href", "#");
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.RenderBeginTag(HtmlTextWriterTag.Span);
                writer.Write(Tip.Trim());
                writer.RenderEndTag();
                writer.RenderEndTag();
            }

            if (Help.Trim() != string.Empty)
            {
                writer.AddAttribute("class", "alert alert-info");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                writer.Write(Help.Trim());
                writer.RenderEndTag();
            }

            writer.RenderEndTag();

            writer.RenderEndTag();
        }
示例#13
0
        protected override void Render(HtmlTextWriter writer)
        {
            AddAttributesToRender(writer);

            if (base.ControlMode == SPControlMode.Display)
            {
                ctrl_Label.RenderControl(writer); // <label/>
            }
            else
            {
                ctrl_Texbox.RenderControl(writer); // <textarea/>
                if (Field.Required)
                {
                    ctrl_TexboxValidator.RenderControl(writer); // <validator/>
                }
            }
        }
示例#14
0
        protected override void Render(HtmlTextWriter writer)
        {
            if (this.Theme != MasterPageTheme.Modern)
            {
                BaseValidatedControl.RenderValidatedControlBeginTag(this.Required && this.ShowRequired, writer, this.Width);
            }

            base.Render(writer);

            if (this.Theme != MasterPageTheme.Modern)
            {
                BaseValidatedControl.RenderValidatedControlEndTag(m_Validator, this.Required, this.DesignMode, this.ErrorMessage, writer);
            }
            else
            {
                m_Validator.RenderControl(writer);
            }
        }
示例#15
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();
                }
            }
        }
示例#16
0
        /// <summary>
        /// render control.
        /// </summary>
        /// <param name="writer"></param>
        protected override void Render(HtmlTextWriter writer)
        {
            AddAttributesToRender(writer);

            literalJScript.RenderControl(writer);

            writer.AddAttribute(
                HtmlTextWriterAttribute.Cellpadding,
                "1", false);
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            dateLabel.RenderControl(writer);

            writer.RenderEndTag();
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            dateTextBox.RenderControl(writer);

            writer.RenderEndTag();
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            dateValidator.RenderControl(writer);

            writer.RenderEndTag();
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            //submitButton.RenderControl(writer);

            writer.RenderEndTag();

            writer.RenderEndTag();

            writer.RenderEndTag();
        }
示例#17
0
        private void RenderNormal(HtmlTextWriter w)
        {
            w.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "1", false);
            w.RenderBeginTag(HtmlTextWriterTag.Table);

            // ROW # 1
            w.AddAttribute(HtmlTextWriterAttribute.Valign, "top");
            w.RenderBeginTag(HtmlTextWriterTag.Tr);
            w.AddAttribute(HtmlTextWriterAttribute.Align, "right");
            w.RenderBeginTag(HtmlTextWriterTag.Td);
            Label1.RenderControl(w);
            w.RenderEndTag();
            //</td>
            w.RenderBeginTag(HtmlTextWriterTag.Td);
            TextBox1.RenderControl(w);
            Add(w, "<br/>");
            LinkButton1.RenderControl(w);
            Add(w, "&nbsp;&nbsp;");
            LinkButton2.RenderControl(w);
            w.RenderEndTag();
            //</td>
            w.RenderBeginTag(HtmlTextWriterTag.Td);
            Add(w, "&nbsp;&nbsp;");
            w.RenderEndTag();
            //</td>
            w.RenderBeginTag(HtmlTextWriterTag.Td);
            RegularExpressionValidator1.RenderControl(w);
            RequiredFieldValidator1.RenderControl(w);
            Label2.RenderControl(w);
            w.RenderEndTag();
            //</td>
            w.RenderEndTag();
            //</tr>
            //</table>
            w.RenderEndTag();
        }
示例#18
0
        /// <summary>
        /// Renders control.
        /// </summary>
        /// <param name="writer">The HtmlTextWriter to render content to.</param>
        protected override void Render(HtmlTextWriter writer)
        {
            EnsureChildControls();

            if (this.Theme != MasterPageTheme.Modern)
            {
                BaseValidatedControl.RenderValidatedControlBeginTag(Required && ShowRequired, writer);
            }

            foreach (System.Web.UI.Control ctrl in Controls)
            {
                if (ctrl.Visible && (ctrl.ID != m_RequiredFieldValidator.ID))
                {
                    ctrl.RenderControl(writer);
                }
            }

            if (this.Theme != MasterPageTheme.Modern)
            {
                BaseValidatedControl.RenderValidatedControlMiddleTag(Required, writer);
            }

            if (Required && Enabled)
            {
                if (!DesignMode && string.IsNullOrEmpty(m_RequiredFieldValidator.ErrorMessage))
                {
                    m_RequiredFieldValidator.ErrorMessage = Resources.TextBox_RequiredValidator_ErrorMessage;
                }
                m_RequiredFieldValidator.RenderControl(writer);
            }

            if (this.Theme != MasterPageTheme.Modern)
            {
                BaseValidatedControl.RenderValidatedControlEndTag(Required, writer);
            }
        }
示例#19
0
        protected override void Render(HtmlTextWriter writer)
        {
            if (IsFormGroup)
            {
                writer.WriteHtmlElement(new HtmlElement(
                                            attributes: new HtmlAttribute[] {
                    new HtmlClassAttribute("form-group")
                }
                                            ), false);
            }

            writer.WriteHtmlElement(new HtmlElement(
                                        isRendered: this.Label.IsSet(),
                                        type: HtmlTextWriterTag.Label,
                                        attributes: new HtmlAttribute[] {
                new HtmlAttribute("for", this.ClientID)
            },
                                        content: this.Label
                                        ));

            if (ShowAddon)
            {
                if (AddonPosition == Position.Left)
                {
                    HtmlAddonElement.Render(writer, this.Addon, false);
                }
                else
                {
                    writer.WriteHtmlElement(new HtmlElement(
                                                attributes: new HtmlAttribute[] {
                        new HtmlClassAttribute("input-group")
                    }), false);
                }
            }

            if (TextMode != TextBoxMode.Multiline)
            {
                writer.WriteHtmlElement(new HtmlElement(
                                            type: HtmlTextWriterTag.Input,
                                            attributes: new HtmlAttribute[] {
                    new HtmlIdAttribute(this.ClientID),
                    new HtmlClassAttribute(this.CssClass),
                    new HtmlNameAttribute(this.UniqueID),
                    new HtmlAttribute("placeholder", this.Placeholder),
                    new HtmlAttribute("type", this.TextMode.ToRender()),
                    new HtmlAttribute("value", this.Text)
                }
                                            ));
            }
            else
            {
                writer.WriteHtmlElement(new HtmlElement(
                                            type: HtmlTextWriterTag.Textarea,
                                            attributes: new HtmlAttribute[] {
                    new HtmlIdAttribute(this.ClientID),
                    new HtmlClassAttribute(this.CssClass),
                    new HtmlNameAttribute(this.UniqueID),
                    new HtmlAttribute("placeholder", this.Placeholder),
                    new HtmlAttribute("value", this.Text)
                }
                                            ));
            }

            if (ShowAddon && AddonPosition == Position.Right)
            {
                writer.WriteHtmlElement(new HtmlElement(
                                            type: HtmlTextWriterTag.Span,
                                            attributes: new HtmlAttribute[] {
                    new HtmlClassAttribute("input-group-addon")
                },
                                            content: this.Addon)
                                        );
            }

            if (ShowAddon)
            {
                writer.RenderEndTag();
            }

            if (IsRequired)
            {
                RequiredFieldValidator.RenderControl(writer);
            }

            if (IsFormGroup)
            {
                writer.RenderEndTag();
            }
        }
示例#20
0
        public override void Render(HtmlTextWriter writer)
        {
            RenderTableBegin(writer, 1, 0);
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            // Display logged on user
            if (LoggedOnUserID > 0 || _userID > 0)
            {
                int userID = _userID;
                if (userID == 0)
                {
                    userID = LoggedOnUserID;
                }

                User user = UserDB.GetUser(userID);

                writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
                writer.RenderBeginTag(HtmlTextWriterTag.P);
                writer.Write(user.Alias + " is logged on.");
                writer.RenderEndTag();                  // P
            }

            // On post back, display whether user is or is not logged on
            if (Page.IsPostBack)
            {
                if (_userID == 0)
                {
                    // Login attempt must have been invalid.  So display this fact.
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
                    writer.RenderBeginTag(HtmlTextWriterTag.P);
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionErrorText");
                    writer.RenderBeginTag(HtmlTextWriterTag.Span);
                    writer.Write("Invalid login attempt.  Please try again.");
                    writer.RenderEndTag();                      // Span
                    writer.RenderEndTag();                      // P
                }
            }

            // Start table into which we will render login controls
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "1");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "1");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            // E-mail row
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.RenderBeginTag(HtmlTextWriterTag.B);
            writer.Write("E-mail:");
            writer.RenderEndTag();              // B
            writer.RenderEndTag();              // Td
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            _emailTextBox.RenderControl(writer);
            writer.RenderEndTag();              // Td
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            _emailValidator.RenderControl(writer);
            writer.RenderEndTag();              // Td
            writer.RenderEndTag();              // Tr

            // Password row
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.RenderBeginTag(HtmlTextWriterTag.B);
            writer.Write("Password:"******"Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.RenderEndTag();              // Td
            writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            _rememberMeCheckBox.RenderControl(writer);
            writer.RenderEndTag();              // Td
            writer.RenderEndTag();              // Tr

            // Gap row
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "3");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("&nbsp;");
            writer.RenderEndTag();              // Td
            writer.RenderEndTag();              // Tr

            // Login button
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.RenderEndTag();              // Td
            writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            _loginButton.RenderControl(writer);
            writer.RenderEndTag();              // Td
            writer.RenderEndTag();              // Tr

            // Close table
            writer.RenderEndTag();              // Table

            writer.RenderEndTag();              // Td
            writer.RenderEndTag();              // Tr
            RenderTableEnd(writer);             // Table
        }
        private void renderCreateTab(HtmlTextWriter output)
        {
            output.WriteFullBeginTag("tr");
            RenderCell("Seminar", "class=\"row1\"");
            RenderCell(seminar.Name, "class=\"row1\"");
            output.WriteEndTag("tr");

            //
            // Render Seminar Dates
            //
            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("class", "row1");
            output.WriteAttribute("nowrap", "true");
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("Dates");
            output.WriteEndTag("td");
            output.WriteBeginTag("td");
            output.WriteAttribute("width", "100%");
            output.WriteAttribute("class", "row2");
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write(seminar.ConstructDateLongString());
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("class", "row1");
            output.WriteAttribute("colspan", "2");
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("<strong>Instructions:</strong> Please enter the person you wish to register below.");
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            //
            // Render Contact
            //
            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("colspan", "2");
            output.WriteAttribute("class", SubHeaderCssClass);
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("Contact Information");
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            //
            // Render Name
            //
            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("class", "row1");
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("Name");
            output.WriteEndTag("td");
            output.WriteBeginTag("td");
            output.WriteAttribute("class", "row2");
            output.Write(HtmlTextWriter.TagRightChar);
            tbName.RenderControl(output);
            output.Write(" ");
            fvName.RenderControl(output);
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            RenderPropertyRows("row1", "row2",
                               new string[] { "Address", "", "City", "State/Province", "PostalCode",
                                              "Country", "Home", "Work" },
                               new Control[] { tbAddress1, tbAddress2, tbCity, tbStateProvince, tbPostalCode,
                                               tbCountry, tbHomePhone, tbWorkPhone });

            //
            // Render Email
            //
            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("class", "row1");
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("Email");
            output.WriteEndTag("td");
            output.WriteBeginTag("td");
            output.WriteAttribute("class", "row2");
            output.Write(HtmlTextWriter.TagRightChar);
            tbEmail1.RenderControl(output);
            output.Write(" ");
            fvEmail1.RenderControl(output);
            evEmail1.RenderControl(output);
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            //
            // Render ClassUnits
            //
            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("class", "row1");
            output.Write(HtmlTextWriter.TagRightChar);
            switch (seminar.ClassUnitType)
            {
            case DojoSeminarClassUnitType.Day:
                output.Write(Localization.Strings.DayUnit_Plural);
                break;

            case DojoSeminarClassUnitType.Class:
                output.Write(Localization.Strings.ClassUnit_Plural);
                break;

            case DojoSeminarClassUnitType.None:
                output.Write("None");
                break;
            }
            output.WriteEndTag("td");
            output.WriteBeginTag("td");
            output.WriteAttribute("class", "row2");
            output.Write(HtmlTextWriter.TagRightChar);
            ddClassUnits.RenderControl(output);
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            //
            // Render Options
            //
            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("colspan", "4");
            output.WriteAttribute("class", SubHeaderCssClass);
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("Options");
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("colspan", "4");
            output.WriteAttribute("class", "row1");
            output.Write(HtmlTextWriter.TagRightChar);

            output.WriteBeginTag("table");
            output.WriteAttribute("width", "100%");
            output.Write(HtmlTextWriter.TagRightChar);

            bool valueSet = false;                                              // keeps track of value setting in input controls!
            DojoSeminarOption option;

            for (int i = 0; i < seminar.Options.Count; i++)
            {
                option = seminar.Options[i];
                output.WriteFullBeginTag("tr");
                output.WriteBeginTag("td");
                output.WriteAttribute("class", "row1");
                output.Write(HtmlTextWriter.TagRightChar);
                if (option.MaxQuantity == 1)
                {
                    output.WriteBeginTag("input");
                    output.WriteAttribute("type", "checkbox");
                    output.WriteAttribute("name", ClientID + "___option" + option.iD.ToString());
                    if (registrationOptions != null)
                    {
                        foreach (DojoSeminarRegistrationOption registrationOption in registrationOptions)
                        {
                            if (registrationOption.parentOption.iD == option.iD)
                            {
                                output.WriteAttribute("checked", "true");
                            }
                        }
                    }
                    output.Write(HtmlTextWriter.TagRightChar);
                }
                else if (option.MaxQuantity > 1)
                {
                    output.WriteBeginTag("input");
                    output.WriteAttribute("type", "text");
                    output.WriteAttribute("name", ClientID + "___qty" + option.iD);
                    output.WriteAttribute("style", "width:35px;");
                    if (registrationOptions != null)
                    {
                        foreach (DojoSeminarRegistrationOption registrationOption in registrationOptions)
                        {
                            if (option.iD == registrationOption.parentOption.iD)
                            {
                                valueSet = true;
                                output.WriteAttribute("value", registrationOption.Quantity.ToString());
                            }
                        }
                    }
                    if (!valueSet)
                    {
                        output.WriteAttribute("value", "0");
                    }
                    valueSet = false;
                    output.Write(HtmlTextWriter.TagRightChar);
                }
                output.WriteEndTag("td");
                output.WriteBeginTag("td");
                output.WriteAttribute("class", "row1");
                output.WriteAttribute("width", "100%");
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write(option.Name);
                if (option.Fee > 0)
                {
                    output.Write(" (");
                    output.Write(option.Fee.ToString("c"));
                    if (option.maxQuantity > 1)
                    {
                        output.Write(" ea.)");
                    }
                    else
                    {
                        output.Write(")");
                    }
                }
                output.WriteEndTag("td");
                output.WriteBeginTag("td");
                output.WriteAttribute("class", "row1");
                output.Write(HtmlTextWriter.TagRightChar);
                output.WriteEndTag("td");
                output.WriteEndTag("tr");

                output.WriteFullBeginTag("tr");
                output.WriteBeginTag("td");
                output.WriteAttribute("class", "row1");
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write("&nbsp;");
                output.WriteEndTag("td");
                output.WriteBeginTag("td");
                output.WriteAttribute("class", "row1");
                output.WriteAttribute("width", "100%");
                output.WriteAttribute("colspan", "2");
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write(option.description);
                output.WriteEndTag("td");
                output.WriteEndTag("tr");
            }

            output.WriteEndTag("table");
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            //
            // Render OK/Cancel Buttons
            //
            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("colspan", "2");
            output.WriteAttribute("align", "right");
            output.WriteAttribute("class", "row1");
            output.Write(HtmlTextWriter.TagRightChar);
            btOk.RenderControl(output);
            output.Write("&nbsp;");
            btCancel.RenderControl(output);
            output.WriteEndTag("td");
            output.WriteEndTag("tr");
        }
示例#22
0
        private void RenderFormControls(HtmlTextWriter writer)
        {
            // Put form controls in their own table
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "1");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "1");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            // Name row
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("Name:");
            writer.RenderEndTag();              // Td
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            _nameLabel.RenderControl(writer);
            writer.RenderEndTag();              // Td
            writer.RenderEndTag();              // Tr

            // Subject row
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("Subject:");
            writer.RenderEndTag();              // Td
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            _subjectTextBox.RenderControl(writer);
            writer.RenderEndTag();              // Td
            writer.RenderEndTag();              // Tr

            // Body row
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "Top");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("Message:");
            writer.RenderEndTag();              // Td
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            _bodyTextBox.RenderControl(writer);
            writer.RenderEndTag();              // Td
            writer.RenderEndTag();              // Tr

            // Pinned drop down list?
            if (_pinnedDropDownList != null)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.Write("Sticky:");
                writer.RenderEndTag();                  // Td
                writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                _pinnedDropDownList.RenderControl(writer);
                writer.RenderEndTag();                  // Td
                writer.RenderEndTag();                  // Tr
            }

            // Notify row
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.RenderEndTag();              // Td
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            _notifyCheckBox.RenderControl(writer);
            writer.RenderEndTag();              // Td
            writer.RenderEndTag();              // Tr

            // Blank row
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("&nbsp;");
            writer.RenderEndTag();              // Td
            writer.RenderEndTag();              // Tr

            // Smiley row
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "Center");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("Smiley:");
            writer.RenderEndTag();              // Td
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            InsertSmiley(writer, ":)", "smiley_smile.gif", "Insert a smile :)");
            InsertSmiley(writer, ";)", "smiley_wink.gif", "Insert a wink ;)");
            InsertSmiley(writer, ";P", "smiley_tongue.gif", "Stick out your tongue ;P");
            InsertSmiley(writer, ":-D", "smiley_biggrin.gif", "Insert a big grin :-D");
            InsertSmiley(writer, ":(", "smiley_frown.gif", "Insert a frown :(");
            InsertSmiley(writer, ":((", "smiley_cry.gif", "Insert tears :((");
            InsertSmiley(writer, ":-O", "smiley_redface.gif", "Insert blush :-O");
            InsertSmiley(writer, ":rolleyes:", "smiley_rolleyes.gif", "Insert roll eyes :rolleyes:");
            InsertSmiley(writer, ":laugh:", "smiley_laugh.gif", "Insert laugh :laugh:");
            InsertSmiley(writer, ":mad:", "smiley_mad.gif", "Insert mad :mad:");
            InsertSmiley(writer, ":confused:", "smiley_confused.gif", "Insert confused :confused:");
            InsertSmiley(writer, ":|", "smiley_line.gif", "Insert Unimpressed :|");
            InsertSmiley(writer, " X| ", "smiley_dead.gif", "Insert unwell X| ");
            InsertSmiley(writer, ":suss:", "smiley_suss.gif", "Insert a suspicious :suss:");
            InsertSmiley(writer, ":cool:", "smiley_cool.gif", "Insert cool :cool:");
            InsertSmiley(writer, ":eek:", "smiley_eek.gif", "Insert an eek! :eek:");
            writer.RenderEndTag();              // Td
            writer.RenderEndTag();              // Tr

            // Blank row
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("&nbsp;");
            writer.RenderEndTag();              // Td
            writer.RenderEndTag();              // Tr

            // Submit button row
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.RenderEndTag();              // Td
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "center");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            _submitButton.RenderControl(writer);
            writer.Write("&nbsp;&nbsp;");
            _subjectValidator.RenderControl(writer);
            writer.Write("&nbsp;&nbsp;");
            _bodyValidator.RenderControl(writer);
            writer.RenderEndTag();              // Td
            writer.RenderEndTag();              // Tr

            // Finish form controls
            writer.RenderEndTag();              // Table
        }
示例#23
0
        /// <summary>
        /// Renders control as a div and all its child controls
        /// </summary>
        /// <param name="output"></param>
        protected override void RenderContents(HtmlTextWriter output)
        {
            //Draw modalBackground
            output.WriteBeginTag("div");
            output.WriteAttribute("class", "modalBackground");
            output.Write(HtmlTextWriter.TagRightChar);
            output.WriteEndTag("div");

            //Draw modalContainer
            output.WriteBeginTag("div");
            output.WriteAttribute("class", "modalContainer");
            output.Write(HtmlTextWriter.TagRightChar);

            //Draw modal
            output.WriteBeginTag("div");
            output.WriteAttribute("class", "modal");
            output.Write(HtmlTextWriter.TagRightChar);

            //Draw modalBody
            output.WriteBeginTag("div");
            output.WriteAttribute("class", "modalBody");
            output.Write(HtmlTextWriter.TagRightChar);

            //Draw content inside modal box
            output.Write("Notes:");
            output.Write("<br />");
            output.Write("<br />");

            _txtNotes.RenderControl(output);

            output.Write("<br />");
            output.Write("<br />");

            //required field
            _rfv.RenderControl(output);

            output.Write("<br />");
            output.WriteBeginTag("p");
            output.WriteAttribute("style", "text-align:center");
            output.Write(HtmlTextWriter.TagRightChar);

            //buttons            //editor menu button for submit
            output.WriteBeginTag("ul");
            output.WriteAttribute("class", "modaltabs");
            output.Write(HtmlTextWriter.TagRightChar);

            //contents
            foreach (WebControl control in this.Controls)
            {
                MenuBarButton button = control as MenuBarButton;
                if (button != null)
                {
                    output.WriteBeginTag("li");
                    output.Write(HtmlTextWriter.TagRightChar);
                    button.RenderControl(output);
                    output.WriteEndTag("li");
                }
            }

            output.WriteEndTag("ul");

            output.WriteEndTag("p");
            //End of content

            output.WriteEndTag("div");
            output.WriteEndTag("div");
            output.WriteEndTag("div");
        }
示例#24
0
 protected override void RenderContents(HtmlTextWriter output)
 {
     output.Write(xText);
     base.RenderContents(output);
     rfv.RenderControl(output);
 }