Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GroupTypeGroupPicker"/> class.
 /// </summary>
 public GroupAndRolePicker()
     : base()
 {
     HelpBlock = new HelpBlock();
     RequiredFieldValidator = new RequiredFieldValidator();
     RequiredFieldValidator.ValidationGroup = this.ValidationGroup;
 }
        public DynamicRadioButtonList()
        {
            controlXML = new DynamicRadioButtonListXml();

            _tbControls = new Table();
            _trControls = new TableRow();
            _tdLabel = new TableCell();
            _tdControl = new TableCell();
            _tdRequired = new TableCell();
            _trControls.Cells.Add(_tdLabel);
            _trControls.Cells.Add(_tdControl);
            _trControls.Cells.Add(_tdRequired);
            _tbControls.Rows.Add(_trControls);

            _radioButtonList = new RadioButtonList();
            _radioButtonList.CausesValidation = false;
            _radioButtonList.RepeatDirection = RepeatDirection.Horizontal;

            _required = new RequiredFieldValidator();
            _required.Display = ValidatorDisplay.Dynamic;
            _required.EnableClientScript = true;
            _required.Text = "*";
            _required.Enabled = false;

            _tdControl.Controls.Add(_radioButtonList);
            _tdRequired.Controls.Add(_required);
            this.Controls.Add(_tbControls);
        }
Example #3
0
        protected override void CreateChildControls()
        {
            //EnsureChildControls();
            base.CreateChildControls();
            Label lblQuestion = new Label();
            //TextBox txtQuestion = new TextBox();
            RequiredFieldValidator valQuestion = new RequiredFieldValidator();
            _txtAnswer = new TextBox();
            _txtAnswer.Text = _answer;

            lblQuestion.ID = "lbl" + _question.QuestionGuid.ToString().Replace("-", String.Empty);
            _txtAnswer.ID = "txt" + _question.QuestionGuid.ToString().Replace("-", String.Empty);
            valQuestion.ID = "val" + _question.QuestionGuid.ToString().Replace("-", String.Empty);

            lblQuestion.Text = _question.QuestionText;
            lblQuestion.AssociatedControlID = _txtAnswer.ID;

            valQuestion.ControlToValidate = _txtAnswer.ID;
            valQuestion.Enabled = _question.AnswerIsRequired;

            valQuestion.Text = _question.ValidationMessage;

            Controls.Add(lblQuestion);
            Controls.Add(_txtAnswer);
            Controls.Add(valQuestion);
        }
Example #4
0
		public TextControl(TextQuestion question)
		{
			_tb = new TextBox {CssClass = "alternative", ID = "q" + question.ID};

			if (question.Rows > 1)
			{
				_tb.TextMode = TextBoxMode.MultiLine;
				_tb.Rows = question.Rows;
			}

			if (question.Columns.HasValue)
			{
				_tb.Columns = question.Columns.Value;
			}

			_l = new Label {CssClass = "label", Text = question.Title, AssociatedControlID = _tb.ID};

			Debug.Assert(Controls != null, "Controls != null");
			Controls.Add(_l);
			Controls.Add(_tb);

			if (!question.Required) return;

			_rfv = new RequiredFieldValidator
			{
				Display = ValidatorDisplay.Dynamic,
				Text = ControlPanel.RequiredField_DefaultText,
				ErrorMessage = string.Format(ControlPanel.RequiredField_DefaultErrorMessage, question.Title),
				ControlToValidate = _tb.ID,
				ValidationGroup = "Form"
			};
			Controls.Add(_rfv);
		}
Example #5
0
        //Override the Create Child Controls event
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            //label for radio button list
            lblTFQuestion = new Label();
            lblTFQuestion.ID = "lblTFQuestion";
            lblTFQuestion.AssociatedControlID = "uxTFQuestion";
            lblTFQuestion.Text = QuestionText;

            //create radio button list
            uxTFQuestion = new RadioButtonList();
            uxTFQuestion.ID = "uxTFQuestion";

            //create validation for radio button list
            reqTFQuestion = new RequiredFieldValidator();
            reqTFQuestion.ID = "reqTFQuestion";
            reqTFQuestion.Display = ValidatorDisplay.Dynamic;
            reqTFQuestion.Text = "*";
            reqTFQuestion.ControlToValidate = "uxTFQuestion";
            reqTFQuestion.ErrorMessage = "No radio selection";

            //create and add list items true and false
            ListItem listTrue = new ListItem("true", "true");
            ListItem listFalse = new ListItem("False", "False");
            uxTFQuestion.Items.Add(listTrue);
            uxTFQuestion.Items.Add(listFalse);

            //add label, radio button list and validator to controls
            Controls.Add(lblTFQuestion);
            Controls.Add(uxTFQuestion);
            Controls.Add(reqTFQuestion);
        }
        public DynamicTextBox(DynamicTextBoxXml xml)
        {
            _textBox = new TextBox();
            _textBox.CausesValidation = false;

            _required = new RequiredFieldValidator();
            _required.Display = ValidatorDisplay.Dynamic;
            _required.EnableClientScript = true;
            _required.Text = "*";
            _required.Enabled = false;
            _required.ClientIDMode = System.Web.UI.ClientIDMode.Static;

            this.Controls.Add(_textBox);
            this.Controls.Add(_required);

            this.ID = xml.Name;
            this.IsRequired = xml.IsRequired;
            this.ErrorMessage = xml.ErrorMessage;
            this.ValidationGroup = xml.ValidationGroup;
            this.MaxLength = xml.MaxLength;
            _textBox.Text = xml.Text;

            this.controlXML = xml;

            this.Visible = xml.Visible;
        }
Example #7
0
        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            Label lblQuestion = new Label();
            _dpAnswer = new DatePickerControl();
            _dpAnswer.SkinID = "Survey";
            _dpAnswer.Text = _answer;
            RequiredFieldValidator valQuestion = new RequiredFieldValidator();

            lblQuestion.ID = "lbl" + _question.QuestionGuid.ToString().Replace("-", String.Empty); ;
            _dpAnswer.ID = "dp" + _question.QuestionGuid.ToString().Replace("-", String.Empty);
            valQuestion.ID = "val" + _question.QuestionGuid.ToString().Replace("-", String.Empty);

            lblQuestion.Text = _question.QuestionText;
            lblQuestion.AssociatedControlID = _dpAnswer.ID;

            valQuestion.ControlToValidate = _dpAnswer.ID;
            valQuestion.Enabled = _question.AnswerIsRequired;

            valQuestion.Text = _question.ValidationMessage;

            Controls.Add(lblQuestion);
            Controls.Add(_dpAnswer);
            Controls.Add(valQuestion);
        }
        public DynamicCountableTextBox(DynamicCountableTextBoxXml xml)
        {
            _textBox = new CountableTextBox();
            _textBox.CausesValidation = false;

            _required = new RequiredFieldValidator();
            _required.Display = ValidatorDisplay.Dynamic;
            _required.EnableClientScript = true;
            _required.Text = "*";
            _required.Enabled = false;
            _required.ClientIDMode = System.Web.UI.ClientIDMode.Static;

            this.Controls.Add(_textBox);
            this.Controls.Add(_required);

            this.ID = xml.Name;
            this.IsRequired = xml.IsRequired;
            this.ErrorMessage = xml.ErrorMessage;
            this.ValidationGroup = xml.ValidationGroup;

            this.MaxChars = xml.MaxChars;
            this.MaxCharsWarning = xml.MaxCharsWarning;
            this.TextMode = xml.TextMode;
            this.Width = new Unit(xml.Width);
            this.Height = new Unit(xml.Height);
            _textBox.Text = xml.Text;

            this.Visible = xml.Visible;

            this.controlXML = xml;

            this.Style[HtmlTextWriterStyle.Display] = "block";
        }
        public DynamicDropDownList(DynamicDropDownListXml xml)
        {
            _dropdown = new DropDownList();
            _dropdown.CausesValidation = false;

            _required = new RequiredFieldValidator();
            _required.Display = ValidatorDisplay.Dynamic;
            _required.EnableClientScript = true;
            _required.Text = "*";
            _required.Enabled = false;
            _required.ClientIDMode = System.Web.UI.ClientIDMode.Static;

            this.Controls.Add(_dropdown);
            this.Controls.Add(_required);

            this.ID = xml.Name;
            this.IsRequired = xml.IsRequired;
            this.ErrorMessage = xml.ErrorMessage;
            this.ValidationGroup = xml.ValidationGroup;
            this.FilterId = xml.FilterId;
            if (!string.IsNullOrEmpty(xml.SelectedValue))
            {
                _dropdown.SelectedValue = xml.SelectedValue;
                _selectedValueOnLoad = xml.SelectedValue;
            }

            this.controlXML = xml;

            this.Visible = xml.Visible;
        }
Example #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RockRadioButtonList"/> class.
 /// </summary>
 public RockRadioButtonList()
     : base()
 {
     RequiredFieldValidator = new RequiredFieldValidator();
     RequiredFieldValidator.ValidationGroup = this.ValidationGroup;
     HelpBlock = new HelpBlock();
 }
        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            Label lblQuestion = new Label();
            _ddAnswer = new DropDownList();
            RequiredFieldValidator valQuestion = new RequiredFieldValidator();

            lblQuestion.ID = "lbl" + _question.QuestionGuid.ToString().Replace("-", String.Empty);
            _ddAnswer.ID = "dd" + _question.QuestionGuid.ToString().Replace("-", String.Empty);
            valQuestion.ID = "val" + _question.QuestionGuid.ToString().Replace("-", String.Empty);

            lblQuestion.Text = _question.QuestionText;
            lblQuestion.AssociatedControlID = _ddAnswer.ID;

            valQuestion.ControlToValidate = _ddAnswer.ID;
            valQuestion.Enabled = _question.AnswerIsRequired;

            _ddAnswer.Items.Add(new ListItem(Resources.SurveyResources.DropDownPleaseSelectText, String.Empty));

            foreach (QuestionOption option in _options)
            {
                ListItem li = new ListItem(option.Answer);
                if (li.Value == _answer) li.Selected = true;
                _ddAnswer.Items.Add(li);
            }

            valQuestion.Text = _question.ValidationMessage;

            Controls.Add(lblQuestion);
            Controls.Add(_ddAnswer);
            Controls.Add(valQuestion);
        }
Example #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RockDropDownList" /> class.
 /// </summary>
 public RockDropDownList()
 {
     RequiredFieldValidator = new RequiredFieldValidator();
     RequiredFieldValidator.ValidationGroup = this.ValidationGroup;
     HelpBlock = new HelpBlock();
     WarningBlock = new WarningBlock();
 }
 protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
 {
     //base.InitializeDataCell(cell, rowState);
     TextBox textBox = new TextBox();
     textBox.ID = this.ControlID;
     textBox.Width = new Unit(GridColumn.Width, UnitType.Pixel);
     if (GridColumn.Size != 0) textBox.MaxLength = GridColumn.Size;
     textBox.DataBinding += new EventHandler(this.textBox_DataBinding);
     base.InitializeDataCell(cell, rowState);
     cell.Controls.Add(textBox);
     CompareValidator vld = new CompareValidator();
     vld.ControlToValidate = textBox.ID;
     vld.ID = textBox.ID + "vld";
     vld.Operator = ValidationCompareOperator.DataTypeCheck;
     vld.ErrorMessage = "не верный формат (2)";
     vld.Text = "! (2)";
     vld.Display = ValidatorDisplay.Dynamic;
     if (GridColumn.Type == typeof(int)) vld.Type = ValidationDataType.Integer;
     if (GridColumn.Type == typeof(decimal)) vld.Type = ValidationDataType.Double;
     if (GridColumn.Type == typeof(string)) vld.Type = ValidationDataType.String;
     cell.Controls.Add(vld);
     if (!GridColumn.AllowNULL)
     {
         RequiredFieldValidator reqvld = new RequiredFieldValidator();
         reqvld.ControlToValidate = textBox.ID;
         reqvld.ID = textBox.ID + "reqvld";
         reqvld.ErrorMessage = "поле не может быть пустым (1)";
         reqvld.Text = "! (1)";
         reqvld.Display = ValidatorDisplay.Dynamic;
         cell.Controls.Add(reqvld);
     }
 }
Example #14
0
 private void AddValidator()
 {
     RequiredFieldValidator rfv = new RequiredFieldValidator();
     rfv.ID = "RequiredFieldValidator2";
     rfv.ControlToValidate   = this.TextBox2.ID;
     rfv.ErrorMessage = "Value is required for this field";
     Page.Controls.Add(rfv);
 }
 protected RequiredFieldValidator GetRequiredFieldValidator(Control control)
 {
     var requiredFieldValidator = new RequiredFieldValidator();
     requiredFieldValidator.ControlToValidate = control.ID;
     requiredFieldValidator.SetFocusOnError = true;
     requiredFieldValidator.ErrorMessage = MandatoryErrorMessage;
     return requiredFieldValidator;
 }
        public void ExibirCritica(string critica)
        {
            RequiredFieldValidator validator = new RequiredFieldValidator();
            validator.ErrorMessage = critica;
            validator.IsValid = false;

            Page.Validators.Add(validator);
        }
        protected override void CreateChildControls()
        {
            input = new TextBox();
            input.ID="input";
            this.Controls.Add(input);
            validator=new RequiredFieldValidator();
            validator.ID="Valinput";
            validator.ControlToValidate=input.ID;

        }
Example #18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HtmlEditor"/> class.
        /// </summary>
        public HtmlEditor()
            : base()
        {
            RequiredFieldValidator = new RequiredFieldValidator();
            RequiredFieldValidator.ValidationGroup = this.ValidationGroup;
            HelpBlock = new HelpBlock();

            TextMode = TextBoxMode.MultiLine;
            Rows = 10;
            Columns = 80;
        }
Example #19
0
		public TagsRow(TagsEditor table)
		{
			this.table = table;

			AddedList = new ListBox();
			TagButton = new Button();
			UntagButton = new Button();
			
			AddButton = new Button();
			AdditionalBox = new TextBox();
			AddValidator = new RequiredFieldValidator();
			AvailableList = new ListBox();
			Label = new Label();
		}
Example #20
0
        public virtual List <System.Web.UI.WebControls.BaseValidator> GetValidators()
        {
            List <WC.BaseValidator> res = new List <WC.BaseValidator>();

            if (Required)
            {
                WC.RequiredFieldValidator reqVal;
                reqVal = new WC.RequiredFieldValidator();
                reqVal.ControlToValidate = MyControl.ID;
                reqVal.ErrorMessage      = this.Caption + " is required";
                reqVal.Display           = WC.ValidatorDisplay.None;
                res.Add(reqVal);
            }
            return(res);
        }
        public DynamicDropDownList()
        {
            controlXML = new DynamicDropDownListXml();

            _dropdown = new DropDownList();
            _dropdown.CausesValidation = false;

            _required = new RequiredFieldValidator();
            _required.Display = ValidatorDisplay.Dynamic;
            _required.EnableClientScript = true;
            _required.Text = "*";
            _required.Enabled = false;

            this.Controls.Add(_dropdown);
            this.Controls.Add(_required);
        }
        public DynamicTextBox()
        {
            _textBox = new TextBox();
            _textBox.CausesValidation = false;

            _required = new RequiredFieldValidator();
            _required.Display = ValidatorDisplay.Dynamic;
            _required.EnableClientScript = true;
            _required.Text = "*";
            _required.Enabled = false;

            this.Controls.Add(_textBox);
            this.Controls.Add(_required);

            this.controlXML = new DynamicTextBoxXml();
        }
        public override void CreateChildControls()
        {
            // E-mail entry text box
            _emailTextBox = new TextBox();
            _emailTextBox.ID = "_emailTextBox";
            _emailTextBox.Width = Unit.Pixel(150);
            _emailTextBox.MaxLength = 100;
            _emailTextBox.CssClass = "WebSolutionFormControl";

            // E-mail validator
            _emailValidator = new RequiredFieldValidator();
            _emailValidator.ControlToValidate = "_emailTextBox";
            _emailValidator.ErrorMessage = "You must enter a valid e-mail address.";

            // Password text box
            _passwordTextBox = new TextBox();
            _passwordTextBox.ID = "_passwordTextBox";
            _passwordTextBox.Width = Unit.Pixel(150);
            _passwordTextBox.MaxLength = 50;
            _passwordTextBox.TextMode = TextBoxMode.Password;
            _passwordTextBox.CssClass = "WebSolutionFormControl";
            _passwordTextBox.Controls.Add(_passwordTextBox);

            // Password validator
            _passwordValidator = new RequiredFieldValidator();
            _passwordValidator.ControlToValidate = "_passwordTextBox";
            _passwordValidator.ErrorMessage = "You must enter a password.";

            // Remember me check box
            _rememberMeCheckBox = new CheckBox();
            _rememberMeCheckBox.Text = "Remember me";
            _rememberMeCheckBox.CssClass = "WebSolutionFormControl";

            // Login button
            _loginButton = new Button();
            _loginButton.Text = "Login";
            _loginButton.Click += new System.EventHandler(LoginButton_Click);
            _loginButton.CssClass = "WebSolutionFormControl";

            // Add child controls to control
            Controls.Add(_emailTextBox);
            Controls.Add(_emailValidator);
            Controls.Add(_passwordTextBox);
            Controls.Add(_passwordValidator);
            Controls.Add(_rememberMeCheckBox);
            Controls.Add(_loginButton);
        }
Example #24
0
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            Question = new Label();
            Question.Text = QuestionText;

            AnswerText = new TextBox();
            AnswerText.ID = "uxAnswerText";
            Controls.Add(Question);
            Controls.Add(new LiteralControl("<br/><br/>"));
            Controls.Add(AnswerText);

            RequiredFieldValidator ReqValidator = new RequiredFieldValidator();
            ReqValidator.ControlToValidate = "uxAnswerText";
            Controls.Add(ReqValidator);
        }
        public DynamicCountableTextBox()
        {
            _textBox = new CountableTextBox();
            _textBox.CausesValidation = false;

            _required = new RequiredFieldValidator();
            _required.Display = ValidatorDisplay.Dynamic;
            _required.EnableClientScript = true;
            _required.Text = "*";
            _required.Enabled = false;

            this.Controls.Add(_textBox);
            this.Controls.Add(_required);

            this.controlXML = new DynamicCountableTextBoxXml();
            this.Style[HtmlTextWriterStyle.Display] = "block";
        }
Example #26
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            _requiredFieldValidator = new RequiredFieldValidator
                                          {
                                              ID = string.Format("{0}_rfv", base.ID),
                                              ControlToValidate = base.ID,
                                              Enabled = Required,
                                              Visible = Required,
                                              ErrorMessage = string.Format("{0} must not be empty.", Title),
                                              Display = ValidatorDisplay.Dynamic,
                                              ValidationGroup = base.ValidationGroup
                                          };

            _requiredFieldValidator.Controls.Add(new Literal {Text = "&nbsp;"});
            //Add error image
            _requiredFieldValidator.Controls.Add(ValidationImageHelper.GetImage(_requiredFieldValidator,
                                                                                _requiredFieldValidator.ErrorMessage));

            //Add required field validator to control
            base.Controls.Add(_requiredFieldValidator);

            _regularExpressionValidator = new RegularExpressionValidator
                                              {
                                                  ID = string.Format("{0}_rev", base.ID),
                                                  ControlToValidate = base.ID,
                                                  Enabled = ValidType != ValidationType.None,
                                                  Visible = ValidType != ValidationType.None,
                                                  ErrorMessage = ValidationHelper.GetValidationErrorMessage(ValidType),
                                                  ValidationExpression =
                                                      ValidationHelper.GetValidationExpression(ValidType),
                                                  Display = ValidatorDisplay.Dynamic,
                                                  ValidationGroup = base.ValidationGroup
                                              };

            _regularExpressionValidator.Controls.Add(new Literal {Text = "&nbsp;"});
            //Add error image
            _regularExpressionValidator.Controls.Add(ValidationImageHelper.GetImage(_regularExpressionValidator,
                                                                                    _regularExpressionValidator.
                                                                                        ErrorMessage));

            //Add required field validator to control
            base.Controls.Add(_regularExpressionValidator);
        }
 public ShortAnsWebQuestion(string strId, bool bRequired, string strRequiredText, string strQuestion, int nCols)
     : base(strId, "shortans", bRequired, strRequiredText, strQuestion)
 {
     this.m_textBox = new TextBox();
     this.Controls.Add(this.m_textBox);
     this.m_textBox.ID = "txt_" + strId;
     this.m_textBox.Columns = nCols;
     if (bRequired)
     {
         RequiredFieldValidator child = new RequiredFieldValidator();
         child.ControlToValidate = this.m_textBox.ID;
         child.EnableClientScript = false;
         child.Text = strRequiredText;
         this.Controls.Add(child);
         this.Controls.Add(new LiteralControl("<br>"));
     }
     this.Controls.Add(new LiteralControl("</p>"));
 }
Example #28
0
 protected override void CreateChildControls()
 {
     base.CreateChildControls();
     Label mylabel = new Label();
     mylabel.AssociatedControlID = "uxAnswerBox";
     mylabel.ID = "lblAnswerBox";
     mylabel.Text = QuestionText;
     Controls.Add(mylabel);
     TextBox mytextbox = new TextBox();
     mytextbox.ID = "uxAnswerBox";
     Controls.Add(mytextbox);
     RequiredFieldValidator validator = new RequiredFieldValidator();
     validator.ID = "valAnswerBox";
     validator.ControlToValidate = "uxAnswerBox";
     validator.Text = "This field is required!";
     validator.ErrorMessage = "Please answer all questions completely";
     Controls.Add(validator);
 }
        protected HtmlTableRow GenerateTableRow(Label label, bool required, Control control, Label description)
        {
            if (required)
            {
                if (control.ID.IsNullOrEmpty())
                {
                    throw new ArgumentException(String.Format("ID Must be entered for required fields, {0}", label.Text));
                }

                RequiredFieldValidator validator = new RequiredFieldValidator()
                {
                    ControlToValidate = control.ID,
                    ErrorMessage = String.Format("{0} is required", label.Text)
                };
                AddValidator(validator);
            }
            return GenerateUnvalidatedTableRow(label, required, control, description);
        }
Example #30
0
        protected override void CreateChildControls()
        {
            this.Controls.Clear();

            this.textBox = new TextBox();
            this.textBox.ID = this.ID;

            this.compareValidator = new CompareValidator();
            this.compareValidator.Display = ValidatorDisplay.Dynamic;

            this.compareValidator.ID = this.ID + "CompareValidator";
            this.compareValidator.ControlToValidate = this.ID;
            this.compareValidator.ValueToCompare = "1/1/1900";
            this.compareValidator.Type = ValidationDataType.Date;

            this.compareValidator.ErrorMessage = CommonResource.InvalidDate;
            this.compareValidator.EnableClientScript = true;
            this.compareValidator.CssClass = this.ValidatorCssClass;

            this.requiredValidator = new RequiredFieldValidator();
            this.requiredValidator.Display = ValidatorDisplay.Dynamic;

            this.requiredValidator.ID = this.ID + "RequiredFieldValidator";
            this.requiredValidator.ControlToValidate = this.ID;
            this.requiredValidator.ErrorMessage = CommonResource.RequiredField;
            this.requiredValidator.EnableClientScript = true;
            this.requiredValidator.CssClass = this.ValidatorCssClass;

            this.Controls.Add(this.textBox);

            if (this.EnableValidation)
            {
                this.Controls.Add(this.compareValidator);
            }

            if (this.Required)
            {
                this.Controls.Add(this.requiredValidator);
            }

            this.AddjQueryUiDatePicker();
        }
Example #31
0
        private void AddReasonTextBox(HtmlGenericControl p)
        {
            this.reasonTextBox = new TextBox();
            this.reasonTextBox.ID = "ReasonTextBox";
            this.reasonTextBox.ClientIDMode = ClientIDMode.Static;
            this.reasonTextBox.TextMode = TextBoxMode.MultiLine;
            this.reasonTextBox.Rows = 5;

            p.Controls.Add(this.reasonTextBox);

            using (RequiredFieldValidator reasonTextBoxRequired = new RequiredFieldValidator())
            {
                reasonTextBoxRequired.ID = "ReasonTextBoxRequired";
                reasonTextBoxRequired.ControlToValidate = this.reasonTextBox.ID;
                reasonTextBoxRequired.EnableClientScript = true;
                reasonTextBoxRequired.ErrorMessage = Labels.ThisFieldIsRequired;
                reasonTextBoxRequired.CssClass = "error-message";
                reasonTextBoxRequired.Display = ValidatorDisplay.Dynamic;
                p.Controls.Add(reasonTextBoxRequired);
            }
        }
Example #32
0
        private void LinkControls(ControlCollection ctrls)
        {
            foreach (Control ctrl in ctrls)
            {
                switch (ctrl.ID)
                {
                case "tgQR":
                    tgQR           = (Toggle)ctrl;
                    tgQR.ImagePath = ThemePath;
                    break;

                case "tgdQR":
                    tgdQR = (ToggleDisplay)ctrl;
                    break;

                case "plhMessage":
                    plhMessage = (PlaceHolder)ctrl;
                    break;

                case "reqUserName":
                    reqUserName = (System.Web.UI.WebControls.RequiredFieldValidator)ctrl;
                    break;

                case "txtUserName":
                    txtUserName = (System.Web.UI.HtmlControls.HtmlInputText)ctrl;
                    break;

                case "reqBody":
                    reqBody = (Label)ctrl;
                    break;

                case "reqSecurityCode":
                    reqSecurityCode = (Label)ctrl;
                    break;

                case "chkSubscribe":
                    chkSubscribe = (CheckBox)ctrl;
                    break;

                case "ambtnSubmit":
                    ambtnSubmit = (ImageButton)ctrl;
                    break;

                case "btnSubmit":
                    btnSubmit = (System.Web.UI.HtmlControls.HtmlInputButton)ctrl;
                    break;

                case "trUsername":
                    trUsername = (System.Web.UI.HtmlControls.HtmlTableRow)ctrl;
                    break;

                case "trCaptcha":
                    trCaptcha = (System.Web.UI.HtmlControls.HtmlTableRow)ctrl;
                    break;

                case "trSubscribe":
                    trSubscribe = (System.Web.UI.HtmlControls.HtmlTableRow)ctrl;
                    break;
                }
                if (ctrl is Controls.ControlsBase)
                {
                    ((Controls.ControlsBase)ctrl).ControlConfig = this.ControlConfig;
                }
                if (ctrl.Controls.Count > 0)
                {
                    LinkControls(ctrl.Controls);
                }
            }
        }
Example #33
0
        private void Controlli(bool ControllaCapit)
        {
            System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator5 = (System.Web.UI.WebControls.RequiredFieldValidator)Panel4.Controls[0].FindControl("RequiredFieldValidator5");
            RequiredFieldValidator5.Validate();
            System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator6 = (System.Web.UI.WebControls.RequiredFieldValidator)Panel4.Controls[0].FindControl("RequiredFieldValidator6");
            RequiredFieldValidator6.Validate();
            System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator7 = (System.Web.UI.WebControls.RequiredFieldValidator)Panel4.Controls[0].FindControl("RequiredFieldValidator7");
            RequiredFieldValidator7.Validate();
            System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator8 = (System.Web.UI.WebControls.RequiredFieldValidator)Panel4.Controls[0].FindControl("RequiredFieldValidator8");
            RequiredFieldValidator8.Validate();

            if (RequiredFieldValidator5.IsValid && RequiredFieldValidator6.IsValid && RequiredFieldValidator7.IsValid && RequiredFieldValidator8.IsValid)
            {
                int      OraInizio    = (GetValue(Panel4, "txtOraStart") == "")?0:int.Parse(GetValue(Panel4, "txtOraStart"));
                int      MinutiInizio = (GetValue(Panel4, "txtMinutiStart") == "")?0:int.Parse(GetValue(Panel4, "txtMinutiStart"));
                int      OraFine      = (GetValue(Panel4, "txtOraEnd") == "")?0:int.Parse(GetValue(Panel4, "txtOraEnd"));
                int      MinutiFine   = (GetValue(Panel4, "txtMinutiEnd") == "")?0:int.Parse(GetValue(Panel4, "txtMinutiEnd"));
                string[] dts          = GetValue(Panel4, "lblDataStart").Split(Convert.ToChar("/"));
                string[] dte          = GetValue(Panel4, "lblDataEnd").Split(Convert.ToChar("/"));
//				string DateS=dts[2] + dts[1] + dts[0] + OraInizio.ToString() + MinutiInizio.ToString();
//				string DateE=dte[2] + dte[1] + dte[0] + OraFine.ToString() + MinutiFine.ToString();


//				if (DateS.CompareTo(DateE)>0)
//				{
//					SetValue(Panel4,"lblError","La data di inizio lavori non può essere maggiore della data di fine lavori.");
//					return;
//				}
                System.DateTime DateS = new System.DateTime(int.Parse(dts[2]), int.Parse(dts[1]), int.Parse(dts[0]), OraInizio, MinutiInizio, 0);
                System.DateTime DateE = new System.DateTime(int.Parse(dte[2]), int.Parse(dte[1]), int.Parse(dte[0]), OraFine, MinutiFine, 0);
                if (DateS > DateE)
                {
                    SetValue(Panel4, "lblError", "La data di inizio lavori non può essere maggiore della data di fine lavori.");
                    return;
                }

                string capitolato = ((System.Web.UI.HtmlControls.HtmlInputHidden)Panel4.Controls[0].FindControl("Hiddetempointervento")).Value;


                if (capitolato != "")
                {
                    string[]        dtp            = GetValue(Panel3, "lblDataRichiesta").Split(Convert.ToChar("/"));
                    string[]        orap           = GetValue(Panel3, "lblOraRichiesta").Split(Convert.ToChar("."));
                    int             Capitolato     = int.Parse(capitolato);
                    System.DateTime DTRichiesta    = new System.DateTime(int.Parse(dtp[2]), int.Parse(dtp[1]), int.Parse(dtp[0]), int.Parse(orap[0]), int.Parse(orap[1]), 0);
                    System.DateTime DTinizioLavori = new System.DateTime(int.Parse(dts[2]), int.Parse(dts[1]), int.Parse(dts[0]), OraInizio, MinutiInizio, 0);

                    System.TimeSpan diff1 = DTinizioLavori.Subtract(DTRichiesta);

                    if (diff1.TotalHours > Capitolato && ControllaCapit == false)
                    {
                        //						SetValue(Panel4,"lblError","Data non conforme al capitolato. Continuare?");
                        ((System.Web.UI.HtmlControls.HtmlTable)Panel4.Controls[0].Controls[0].FindControl("tableconferma")).Visible = true;
                        ((System.Web.UI.HtmlControls.HtmlTable)Panel4.Controls[0].Controls[0].FindControl("tableSalva")).Visible    = false;
                        return;
                    }
                    else
                    {
                        string[] dtpia = GetValue(Panel1, "ldldatap").Split(Convert.ToChar("/"));
                        string   OraP  = GetValue(Panel1, "lblorap");
                        string[] orapia;
                        if (OraP.IndexOf(".") > 0)
                        {
                            orapia = OraP.Split(Convert.ToChar("."));
                        }
                        else
                        {
                            orapia = OraP.Split(Convert.ToChar(":"));
                        }

                        System.DateTime DPianificata = new System.DateTime(int.Parse(dtpia[2]), int.Parse(dtpia[1]), int.Parse(dtpia[0]), int.Parse(orapia[0]), int.Parse(orapia[1]), 0);
                        if (DPianificata > DTinizioLavori)
                        {
                            SetValue(Panel4, "lblError", "La Data Inizio Lavori  è minore della Data richiesta Lavoro!");
                            return;
                        }
                    }
                }

                UpdateRichiesta();
            }
        }
Example #34
0
 /// <include file='doc\RequiredFieldValidator.uex' path='docs/doc[@for="RequiredFieldValidator.CreateWebValidator"]/*' />
 protected override WebCntrls.BaseValidator CreateWebValidator()
 {
     _webRequiredFieldValidator = new WebCntrls.RequiredFieldValidator();
     return(_webRequiredFieldValidator);
 }