Exemple #1
0
        /// <summary>
        /// Initializes a new insance of the StringControl class.
        /// </summary>
        /// <param name="definition">Definition of the property.</param>
        /// <param name="mode">The current design mode.</param>
        public CheckBoxControl( ref XmlElement definition, string mode)
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();
            #region Use Standard Sizes

            valueControl.Top =  Property.ValueTop;
            valueControl.Left = Property.ValueLeft;
            valueControl.Width = Property.ValueWidth;
            this.Height = valueControl.Height + Property.PropertyMarginBottom;

            #endregion
            //opr = _opr;
            _definition = definition;

            // Initialize control
            Initialize(_definition);

            valueControl.Text = this.Label;

            if (_definition.Attributes["checked"] != null && _definition.Attributes["checked"].Value == "true")
                valueControl.Checked = true;

            /*
             * Check required
             */
            if (IsRequired(_definition, mode) == true)
            {
                req = new RequiredFieldValidator();
                req.ControlToValidate = this.valueControl;
                req.ErrorMessage = Resources.GetString(ResourceTokens.ValidatorRequired);
                req.IconPadding = 2;
            }
        }
 protected void CustomFieldsRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     HtmlTableCell CustomFieldCell = e.Item.FindControl("CustomField") as HtmlTableCell;
     if (CustomFieldCell == null)
         return;
     CustomField field = e.Item.DataItem as CustomField;
     if (field == null)
         return;
     switch (field.CustomFieldTypeName)
     {
         case "TextBox":
             TextBox CustomFieldTextBox = new TextBox();
             CustomFieldTextBox.ID = "CustomFieldControl";
             CustomFieldCell.Controls.Add(CustomFieldTextBox);
             if (field.IsRequired)
             {
                 RequiredFieldValidator CustomFieldTextBoxRequiredFieldValidator = new RequiredFieldValidator();
                 CustomFieldTextBoxRequiredFieldValidator.ControlToValidate = "CustomFieldControl";
                 CustomFieldTextBoxRequiredFieldValidator.ErrorMessage = "Required";
                 //CustomFieldTextBoxRequiredFieldValidator
                 CustomFieldCell.Controls.Add(CustomFieldTextBoxRequiredFieldValidator);
             }
             break;
         case "CheckBox":
             CheckBox CustomFieldCheckBox = new CheckBox();
             CustomFieldCheckBox.ID = "CustomFieldControl";
             CustomFieldCell.Controls.Add(CustomFieldCheckBox);
             break;
         default:
             TextBox DefaultCustomFieldTextBox = new TextBox();
             DefaultCustomFieldTextBox.ID = "CustomFieldControl";
             CustomFieldCell.Controls.Add(DefaultCustomFieldTextBox);
             break;
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        Alert.Visible = false;

        if (StandardOperatingProcedure.Current.Title == null)
        {
            Response.Redirect("Error.aspx", false);
        }
        else
        {
            SOPTitle.InnerHtml = StandardOperatingProcedure.Current.Title;

            metadata = new TextBox[StandardOperatingProcedure.Current.MetadataCount];

            for (int i = 0; i < StandardOperatingProcedure.Current.MetadataCount; i++)
            {
                TableRow row = new TableRow();
                TableCell leftCell = new TableCell();
                TableCell rightCell = new TableCell();
                if (StandardOperatingProcedure.Current.Data[i].IsRequired)
                {
                    leftCell.Text = StandardOperatingProcedure.Current.Data[i].Title + " <span class='required'>*</span>";
                }
                else
                {
                    leftCell.Text = StandardOperatingProcedure.Current.Data[i].Title;
                }
                row.Cells.Add(leftCell);
                TextBox textBox = new TextBox();
                textBox.ID = StandardOperatingProcedure.Current.Data[i].ID;
                if (!String.IsNullOrEmpty(StandardOperatingProcedure.Current.Data[i].Value))
                {
                    textBox.Text = StandardOperatingProcedure.Current.Data[i].Value;
                }
                else
                {
                    textBox.Attributes.Add("placeholder", StandardOperatingProcedure.Current.Data[i].Title);
                }
                rightCell.Controls.Add(textBox);
                if (StandardOperatingProcedure.Current.Data[i].IsRequired)
                {
                    RequiredFieldValidator validator = new RequiredFieldValidator();
                    validator.ControlToValidate = textBox.ID;
                    validator.ErrorMessage = StandardOperatingProcedure.Current.Data[i].Title + " is a required field.";
                    validator.ForeColor = System.Drawing.Color.Red;
                    validator.Attributes.Add("class", "validator");
                    rightCell.Controls.Add(validator);
                }
                metadata[i] = textBox;
                row.Cells.Add(rightCell);
                Metadata.Rows.Add(row);
            }
        }
    }
Exemple #4
0
 public static void CrearValidador(GridEditableItem item, string editorColumna, string idControl)
 {
     var editor = (GridTextBoxColumnEditor)item.EditManager.GetColumnEditor(editorColumna);
     var cell = (TableCell)editor.TextBoxControl.Parent;
     var validator = new RequiredFieldValidator();
     editor.TextBoxControl.ID = idControl;
     validator.ControlToValidate = editor.TextBoxControl.ID;
     validator.Display = ValidatorDisplay.Dynamic;
     validator.ErrorMessage = @"<span style='display: inline; float: right'><img src='../Imagenes/Controles/imgError.gif' title='Este campo es requerido.' alt='' /></span>";
     cell.Controls.Add(validator);
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        ListBox1 = new Obout.ListBox.ListBox();
        ListBox1.ID = "ListBox1";
        ListBox1.Width = Unit.Pixel(125);

        ListBoxItem1 = new ListBoxItem();
        ListBoxItem1.ID = "ListBoxItem1";
        ListBoxItem1.Text = "10";

        ListBoxItem2 = new ListBoxItem();
        ListBoxItem2.ID = "ListBoxItem2";
        ListBoxItem2.Text = "50";

        ListBoxItem3 = new ListBoxItem();
        ListBoxItem3.ID = "ListBoxItem3";
        ListBoxItem3.Text = "75";

        ListBoxItem4 = new ListBoxItem();
        ListBoxItem4.ID = "ListBoxItem4";
        ListBoxItem4.Text = "100";

        ListBoxItem5 = new ListBoxItem();
        ListBoxItem5.ID = "ListBoxItem5";
        ListBoxItem5.Text = "1000";

        ListBox1.Items.Add(ListBoxItem1);
        ListBox1.Items.Add(ListBoxItem2);
        ListBox1.Items.Add(ListBoxItem3);
        ListBox1.Items.Add(ListBoxItem4);
        ListBox1.Items.Add(ListBoxItem5);

        RequiredFieldValidator1 = new RequiredFieldValidator();
        RequiredFieldValidator1.ID = "Validator1";
        RequiredFieldValidator1.ControlToValidate = "ListBox1";
        RequiredFieldValidator1.ErrorMessage = "Please select a value.";
        RequiredFieldValidator1.CssClass = "tdText";
        RequiredFieldValidator1.Display = ValidatorDisplay.Dynamic;

        RangeValidator1 = new RangeValidator();
        RangeValidator1.ID = "RangeValidator1";
        RangeValidator1.ControlToValidate = "ListBox1";
        RangeValidator1.Display = ValidatorDisplay.Dynamic;
        RangeValidator1.ErrorMessage = "Please specify a value between 50 and 100.";
        RangeValidator1.MinimumValue = "50";
        RangeValidator1.MaximumValue = "100";
        RangeValidator1.Type = ValidationDataType.Integer;
        RangeValidator1.CssClass = "tdText";

        ListBox1Container.Controls.Add(ListBox1);
        ValidatorContainer.Controls.Add(RequiredFieldValidator1);
        ValidatorContainer.Controls.Add(RangeValidator1);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        SuperForm1 = new SuperForm();
        SuperForm1.ID = "SuperForm1";
        SuperForm1.Title = "Order Details";
        SuperForm1.DataSourceID = "SqlDataSource1";
        SuperForm1.AutoGenerateRows = false;
        SuperForm1.AutoGenerateInsertButton = true;
        SuperForm1.AutoGenerateEditButton = true;
        SuperForm1.AutoGenerateDeleteButton = true;
        SuperForm1.DataKeyNames = new string[] { "OrderID" };
        SuperForm1.AllowPaging = true;
        SuperForm1.DefaultMode = DetailsViewMode.Insert;
        SuperForm1.AllowDataKeysInsert = false;
        SuperForm1.EnableModelValidation = true;
        SuperForm1.DataBound += SuperForm1_DataBound;

        RequiredFieldValidator RequiredFieldValidator1 = new RequiredFieldValidator();
        RequiredFieldValidator1.ID = "RequiredFieldValidator1";
        RequiredFieldValidator1.ErrorMessage = "*";
        RequiredFieldValidator1.InitialValue = "Select a customer ...";

        RequiredFieldValidator RequiredFieldValidator2 = new RequiredFieldValidator();
        RequiredFieldValidator2.ID = "RequiredFieldValidator2";
        RequiredFieldValidator2.ErrorMessage = "*";
        RequiredFieldValidator2.InitialValue = "Select a country ...";

        Obout.SuperForm.BoundField field1 = new Obout.SuperForm.BoundField();
        field1.DataField = "OrderID";
        field1.HeaderText = "OrderID";
        field1.ReadOnly = true;
        field1.InsertVisible = false;

        Obout.SuperForm.DropDownListField field2 = new Obout.SuperForm.DropDownListField();
        field2.DataField = "CustomerID";
        field2.DisplayField = "CompanyName";
        field2.HeaderText = "Customer";
        field2.DataSourceID = "SqlDataSource3";
        field2.Validators.Add(RequiredFieldValidator1);

        Obout.SuperForm.DropDownListField field3 = new Obout.SuperForm.DropDownListField();
        field3.DataField = "ShipCountry";
        field3.HeaderText = "Country";
        field3.DisplayField = "ShipCountry";
        field3.DataSourceID = "SqlDataSource2";
        field3.Validators.Add(RequiredFieldValidator2);

        SuperForm1.Fields.Add(field1);
        SuperForm1.Fields.Add(field2);
        SuperForm1.Fields.Add(field3);

        SuperForm1Container.Controls.Add(SuperForm1);
    }
Exemple #7
0
    /// <summary>
    /// Bind control display based on properties set
    /// </summary>
    public void Bind()
    {
        ProductAdmin _adminAccess = new ProductAdmin();

        DataSet MyDataSet = _adminAccess.GetAttributeTypeByProductTypeID(productTypeID);

        //Repeats until Number of AttributeType for this Product
        foreach (DataRow dr in MyDataSet.Tables[0].Rows)
        {
            //Bind Attributes
            DataSet _AttributeDataSet = _adminAccess.GetByAttributeTypeID(int.Parse(dr["attributetypeid"].ToString()));

            System.Web.UI.WebControls.DropDownList lstControl = new DropDownList();
            lstControl.ID = "lstAttribute" + dr["AttributeTypeId"].ToString();

            ListItem li = new ListItem(dr["Name"].ToString(), "0");
            li.Selected = true;

            lstControl.DataSource = _AttributeDataSet;
            lstControl.DataTextField = "Name";
            lstControl.DataValueField = "AttributeId";
            lstControl.DataBind();
            lstControl.Items.Insert(0, li);

            if (!Convert.ToBoolean(dr["IsPrivate"]))
            {
                //Add Dynamic Attribute DropDownlist in the Placeholder
                ControlPlaceHolder.Controls.Add(lstControl);

                //Required Field validator to check SKU Attribute
                RequiredFieldValidator FieldValidator = new RequiredFieldValidator();
                FieldValidator.ID = "Validator" + dr["AttributeTypeId"].ToString();
                FieldValidator.ControlToValidate = "lstAttribute" + dr["AttributeTypeId"].ToString();
                FieldValidator.ErrorMessage = "Select " + dr["Name"].ToString();
                FieldValidator.Display = ValidatorDisplay.Dynamic;
                FieldValidator.CssClass = "Error";
                FieldValidator.InitialValue = "0";

                ControlPlaceHolder.Controls.Add(FieldValidator);
                Literal lit1 = new Literal();
                lit1.Text = "&nbsp;&nbsp;";
                ControlPlaceHolder.Controls.Add(lit1);
            }

        }

        //Hide the Product Attribute
        if (MyDataSet.Tables[0].Rows.Count == 0)
        {
            DivAttributes.Visible = false;
        }
    }
Exemple #8
0
        /// <summary>
        /// Initializes a new insance of the StringControl class.
        /// </summary>
        /// <param name="definition">Definition of the property.</param>
        /// <param name="mode">The current design mode.</param>
        public EnumerationControl(XmlElement definition, string mode)
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();
            //opr = _opr;
            #region Use Standard Sizes

            labelControl.Top = Property.LabelTop;
            labelControl.Left = Property.LabelLeft;
            labelControl.Width = Property.LabelWidth;
            valueControl.Top =  Property.ValueTop;
            valueControl.Left = Property.ValueLeft;
            valueControl.Width = Property.ValueWidth;

            this.Height = valueControl.Height + Property.PropertyMarginBottom;

            #endregion

            // Initialize control
            Initialize( definition );

            //
            labelControl.Text = this.Label;
            valueControl.Text = "";

            /*
             *
             */
            if ( definition.Attributes[ "itemName" ] != null )
                _itemName = definition.Attributes[ "itemName" ].Value;
            else if ( this.Id.EndsWith( "s" ) )
                _itemName = this.Id.Substring( 0, this.Id.Length-1 );
            else
                _itemName = this.Id;

            /*
             * Height / number of rows.
             */
            labelControl.Height = valueControl.Height;

            /*
             * Check required
             */
            if ( IsRequired( definition, mode ) == true )
            {
                required = new RequiredFieldValidator();
                required.ControlToValidate = this.valueControl;
                required.ErrorMessage = Resources.GetString( ResourceTokens.ValidatorRequired );
                required.IconPadding = 2;
                this.valueControl.BackColor = Resources.GetColor("required");
            }
        }
 public void InstantiateIn(Control container)
 {
     TextBox child = new TextBox();
     child.DataBinding += new EventHandler(this.BindData);
     container.Controls.Add(child);
     child.ID = this.column;
     RequiredFieldValidator validator = new RequiredFieldValidator {
         Text = "Please Answer",
         ControlToValidate = child.ID,
         Display = ValidatorDisplay.Dynamic,
         ID = "validate" + child.ID
     };
     container.Controls.Add(validator);
 }
Exemple #10
0
        protected override void CreateChildControls()
        {
            Controls.Clear();

            if (Field != null)
            {
                if (base.ControlMode == SPControlMode.Display)
                {
                    ctrl_Label    = new Label();
                    ctrl_Label.ID = Field.InternalName;
                    this.Controls.Add(ctrl_Label);
                }
                else
                {
                    ListControl listCtrl = this.ControlByType;
                    if (listCtrl != null)
                    {
                        listCtrl.ID = Field.InternalName;
                        listCtrl.Items.AddRange(((DbFieldChoice)Field).Choices.Select(x => new ListItem(x)).ToArray());
                        this.Controls.Add(listCtrl);

                        if (Field.Required)
                        {
                            if (ctrl_CheckList == null)
                            {
                                ctrl_ChoiceValidator    = new RequiredFieldValidator();
                                ctrl_ChoiceValidator.ID = Field.InternalName + "Validator";
                                ctrl_ChoiceValidator.ControlToValidate = listCtrl.ID;
                                ctrl_ChoiceValidator.Text     = "You can't leave this blank";
                                ctrl_ChoiceValidator.Display  = ValidatorDisplay.Dynamic;
                                ctrl_ChoiceValidator.CssClass = "ms-formvalidation";
                                this.Controls.Add(ctrl_ChoiceValidator);
                            }
                            else
                            {
                                ctrl_ChoiceValidatorForListBox          = new CustomValidator();
                                ctrl_ChoiceValidatorForListBox.ID       = Field.InternalName + "Validator";
                                ctrl_ChoiceValidatorForListBox.Text     = "You can't leave this blank";
                                ctrl_ChoiceValidatorForListBox.Display  = ValidatorDisplay.Dynamic;
                                ctrl_ChoiceValidatorForListBox.CssClass = "ms-formvalidation";
                                ctrl_ChoiceValidatorForListBox.ClientValidationFunction = string.Format("DoValidationFor_{0}", Field.InternalName);
                                this.Controls.Add(ctrl_ChoiceValidatorForListBox);
                            }
                        }
                    }
                }
            }
        }
        //private void LLenaCombosprocesador()
        //{
        //    for (int i = 0; i < 21; i++)
        //    {
        //        ddlProcesadores.Items.Add(i.ToString());
        //        //ddlDiscosDuros.Items.Add(i.ToString());
        //    }
        //}

        //private void LLenaCombosDiscos()
        //{
        //    for (int i = 0; i < 11; i++)
        //    {
        //        //ddlProcesadores.Items.Add(i.ToString());
        //        ddlDiscosDuros.Items.Add(i.ToString());
        //    }
        //}

        private void GeneraControles(int numeroControles)
        {
            if (numeroControles != 0)
            {
                for (int i = 3; i < (3 + numeroControles); i++)
                {
                    TableRow tRow = new TableRow();

                    TableCell tCell1 = new TableCell();
                    tCell1.HorizontalAlign = HorizontalAlign.Right;
                    TableCell tCell2 = new TableCell();
                    tCell1.HorizontalAlign = HorizontalAlign.Left;
                    Label lblDiscoTamanio = new Label();
                    lblDiscoTamanio.ID   = "lblDiscoTamanio" + i;
                    lblDiscoTamanio.Text = "Tamaño disco " + (i - 2) + ":";
                    TextBox txtTamDisco2 = new TextBox();
                    txtTamDisco2.ID    = "txtTamDisco" + i;
                    txtTamDisco2.Text  = "";
                    txtTamDisco2.Width = 120;
                    RequiredFieldValidator rfvKeyD2 = new RequiredFieldValidator();
                    rfvKeyD2.Display           = ValidatorDisplay.None;
                    rfvKeyD2.SetFocusOnError   = true;
                    rfvKeyD2.ControlToValidate = "txtTamDisco" + i;
                    rfvKeyD2.ErrorMessage      = "El campo \"" + "Tamaño disco " + (i - 2) + "\" es requerido";
                    rfvKeyD2.ValidationGroup   = "vgGuardaRegistroArticulo";
                    rfvKeyD2.CssClass          = "label";
                    rfvKeyD2.ID = "rfvTamDisco" + i;

                    ValidatorCalloutExtender vceKeyD2 = new ValidatorCalloutExtender();
                    vceKeyD2.ID = "vceTamDisco" + i;
                    vceKeyD2.TargetControlID = "rfvTamDisco" + i;

                    tCell1.Controls.Add(lblDiscoTamanio);
                    tCell2.Controls.Add(txtTamDisco2);
                    tCell2.Controls.Add(rfvKeyD2);
                    tCell2.Controls.Add(vceKeyD2);

                    TableCell tCell3 = new TableCell();
                    TableCell tCell4 = new TableCell();

                    tRow.Controls.Add(tCell1);
                    tRow.Controls.Add(tCell2);
                    tRow.Controls.Add(tCell3);
                    tRow.Controls.Add(tCell4);
                    //tblDetalleServidor.Controls.AddAt(i, tRow);
                }
            }
        }
Exemple #12
0
        public bool Validar(bool validarControlInterno)
        {
            if (validarControlInterno)
            {
                RequiredFieldValidator     valRequeridoCalle      = (RequiredFieldValidator)this.phValidCalle.FindControl("valRequeridoCalle");
                RegularExpressionValidator valDescripcionCalle    = (RegularExpressionValidator)this.phValidCalle.FindControl("valDescripcionCalle");
                RegularExpressionValidator valEnteroNroCalle      = (RegularExpressionValidator)this.phValidCalleNro.FindControl("valEnteroNroCalle");
                CustomValidator            cstmValidatorProvincia = (CustomValidator)phValidProvincia.FindControl("cstmValidatorProvincia");
                CustomValidator            cstmValidatorLocalidad = (CustomValidator)phValidLocalidad.FindControl("cstmValidatorLocalidad");

                valRequeridoCalle.Enabled   = true;
                valDescripcionCalle.Enabled = true;
                valEnteroNroCalle.Enabled   = true;
                //valRequeridoTelefono.Enabled = true;
                cstmValidatorProvincia.Enabled = true;
                cstmValidatorLocalidad.Enabled = true;
                valRequeridoCalle.Validate();
                valDescripcionCalle.Validate();
                valEnteroNroCalle.Validate();
                //valRequeridoTelefono.Validate();
                cstmValidatorProvincia.Validate();
                cstmValidatorLocalidad.Validate();
                if (valRequeridoCalle.IsValid && valDescripcionCalle.IsValid && valEnteroNroCalle.IsValid && cstmValidatorProvincia.IsValid && cstmValidatorLocalidad.IsValid)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                RequiredFieldValidator     valRequeridoCalle   = (RequiredFieldValidator)this.phValidCalle.FindControl("valRequeridoCalle");
                RegularExpressionValidator valDescripcionCalle = (RegularExpressionValidator)this.phValidCalle.FindControl("valDescripcionCalle");
                RegularExpressionValidator valEnteroNroCalle   = (RegularExpressionValidator)this.phValidCalleNro.FindControl("valEnteroNroCalle");
                //RequiredFieldValidator valRequeridoTelefono = (RequiredFieldValidator)this.phValidTelefono.FindControl("valRequeridoTelefono");
                RequiredFieldValidator valRequeridoProvincia = (RequiredFieldValidator)this.phValidCalle.FindControl("valRequeridoProvincia");
                RequiredFieldValidator valRequeridoLocalidad = (RequiredFieldValidator)this.phValidCalle.FindControl("valRequeridoLocalidad");
                valRequeridoCalle.Enabled   = false;
                valDescripcionCalle.Enabled = false;
                valEnteroNroCalle.Enabled   = false;
                //valRequeridoTelefono.Enabled = true;
                valRequeridoProvincia.Enabled = false;
                valRequeridoLocalidad.Enabled = false;
                return(true);
            }
        }
        private void CreateLayout()
        {
            var container = new HtmlGenericControl("div");

            var p = new HtmlGenericControl("p");

            p.Controls.Add(errorMessageLabel);
            container.Controls.Add(p);

            container.Controls.Add(groupValidationSummary);

            p = new HtmlGenericControl("p");
            p.Controls.Add(titleLabel);
            container.Controls.Add(p);

            p = new HtmlGenericControl("p");
            var validator = new RequiredFieldValidator();

            validator.ControlToValidate = userNameTextBox.ID;
            validator.ValidationGroup   = validationGroupName;
            validator.ErrorMessage      = EmptyUserNameText;
            p.Controls.Add(userNameLabel);
            p.Controls.Add(userNameTextBox);
            p.Controls.Add(validator);
            container.Controls.Add(p);

            p         = new HtmlGenericControl("p");
            validator = new RequiredFieldValidator();
            validator.ControlToValidate = passwordTextBox.ID;
            validator.ValidationGroup   = validationGroupName;
            validator.ErrorMessage      = EmptyPasswordText;
            p.Controls.Add(passwordLabel);
            p.Controls.Add(passwordTextBox);
            p.Controls.Add(validator);
            container.Controls.Add(p);

            p = new HtmlGenericControl("p");
            p.Controls.Add(rememberMeCheckBox);
            container.Controls.Add(rememberMeCheckBox);



            p = new HtmlGenericControl("p");
            p.Controls.Add(loginButton);
            container.Controls.Add(p);

            Controls.Add(container);
        }
Exemple #14
0
        public TextControl(TextQuestion question)
        {
            _tb = new TextBox {
                CssClass = "alternative"
            };
            if (question.ID > 0)
            {
                _tb.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
            };
            if (question.ID > 0)
            {
                _l.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);
        }
Exemple #15
0
        public static void SetValidators(Page wpage)
        {
            RequiredFieldValidator valid = null;

            for (int i = 0; i <= 100; i++)
            {
                valid = (RequiredFieldValidator)wpage.FindControl("RequiredFieldValidator" + i.ToString());
                if (valid != null)
                {
                    valid.ToolTip      = valid.ErrorMessage + " Click this link move to field " + valid.ControlToValidate;
                    valid.ErrorMessage = "<a href=\"JavaScript:SetFocus('" + valid.ControlToValidate + "')\"><b><font color=\"#800000\">ERROR</font></b><font color='blue'> - <u>" + valid.ErrorMessage.Replace("ERROR - ", "") + "</u></font></a>";
                }
            }
            RegularExpressionValidator rgValid = null;

            for (int i = 0; i <= 100; i++)
            {
                rgValid = (RegularExpressionValidator)wpage.FindControl("RegularExpressionValidator" + i.ToString());
                if (rgValid != null)
                {
                    rgValid.ToolTip      = rgValid.ErrorMessage + " Click this link move to field " + rgValid.ControlToValidate;
                    rgValid.ErrorMessage = "<a href=\"JavaScript:SetFocus('" + rgValid.ControlToValidate + "')\"><b><font color=\"#800000\">ERROR</font></b><font color='blue'> - <u>" + rgValid.ErrorMessage.Replace("ERROR - ", "") + "</u></font></a>";
                }
            }
            CompareValidator compValid = null;

            for (int i = 0; i <= 100; i++)
            {
                compValid = (CompareValidator)wpage.FindControl("CompareValidator" + i.ToString());
                if (compValid != null)
                {
                    compValid.ToolTip      = compValid.ErrorMessage + " Click this link move to field " + compValid.ControlToValidate;
                    compValid.ErrorMessage = "<a href=\"JavaScript:SetFocus('" + compValid.ControlToValidate + "')\"><b><font color=\"#800000\">ERROR</font></b><font color='blue'> - <u>" + compValid.ErrorMessage.Replace("ERROR - ", "") + "</u></font></a>";
                }
            }

            RangeValidator RangeValid = null;

            for (int i = 0; i <= 100; i++)
            {
                RangeValid = (RangeValidator)wpage.FindControl("RangeValidator" + i.ToString());
                if (RangeValid != null)
                {
                    RangeValid.ToolTip      = RangeValid.ErrorMessage + " Click this link move to field " + RangeValid.ControlToValidate;
                    RangeValid.ErrorMessage = "<a href=\"JavaScript:SetFocus('" + RangeValid.ControlToValidate + "')\"><b><font color=\"#800000\">ERROR</font></b><font color='blue'> - <u>" + RangeValid.ErrorMessage.Replace("ERROR - ", "") + "</u></font></a>";
                }
            }
        }
        protected override void CreateChildControls()
        {
            if (this.EditMode)
            {
                // Build out the edit controls.
            }

            if (this.ValidationControl != null)
            {
                if (this.DisplayType == FormElementDisplayType.Textbox && !string.IsNullOrEmpty(this.DataType.ValidationString))
                {
                    // Build out the regex validator.
                    RegularExpressionValidator rgx = new RegularExpressionValidator();
                    rgx.ID = "RgxValidator_" + this.ElementProviderKey.ToString();
                    rgx.EnableClientScript   = true;
                    rgx.Display              = (this.UseValidatorControlExtender ? ValidatorDisplay.None : ValidatorDisplay.Dynamic);
                    rgx.ControlToValidate    = this.ValidationControl.ID;
                    rgx.ErrorMessage         = "This is not a valid entry.  Please enter a valid " + this.DataType.DataTypeName + ".";
                    rgx.ForeColor            = System.Drawing.Color.Red;
                    rgx.ValidationExpression = this.DataType.ValidationString;
                    rgx.ValidationGroup      = "DynamicForm_" + this._qData.FormProviderKey.ToString();
                    this.Controls.Add(rgx);

                    if (this.UseValidatorControlExtender)
                    {
                        AjaxControlToolkit.ValidatorCalloutExtender rgxExt = new AjaxControlToolkit.ValidatorCalloutExtender();
                        rgxExt.ID = "RgxExtender_" + this.ElementProviderKey.ToString();
                        rgxExt.TargetControlID = rgx.ID;
                    }
                }

                if (this.Required)
                {
                    // Build out the required field validator.
                    RequiredFieldValidator req = new RequiredFieldValidator();
                    req.ID = "ReqValidator_" + this.ElementProviderKey.ToString();
                    req.EnableClientScript = true;
                    req.Display            = (this.UseValidatorControlExtender ? ValidatorDisplay.None : ValidatorDisplay.Dynamic);
                    req.ControlToValidate  = this.ValidationControl.ID;
                    req.ErrorMessage       = "This field is required.";
                    req.ForeColor          = System.Drawing.Color.Red;
                    req.ValidationGroup    = "DynamicForm_" + this._qData.FormProviderKey.ToString();
                    this.Controls.Add(req);
                }
            }

            base.CreateChildControls();
        }
Exemple #17
0
        /// <summary>
        /// Fills the XML form data based on a value.
        /// </summary>
        /// <param name="value"></param>
        public override void Set(string value, bool required, bool disabled, bool invisible, bool forceReplacement)
        {
            EnsureDataBind();

            ComboBoxObject cgi;
            bool           found = false;
            int            i, len = valueControl.Items.Count;

            if (valueControl.Text.Replace(" ", "").Length == 0 || forceReplacement)
            {
                for (i = 0; i < len; i++)
                {
                    cgi = (ComboBoxObject)valueControl.Items[i];
                    if (value == cgi.Code)
                    {
                        valueControl.SelectedIndex = i;
                        i     = len;
                        found = true;
                    }
                }
                if (found == false)
                {
                    valueControl.SelectedIndex = -1;
                    valueControl.Text          = value;
                }
            }

            if (required)
            {
                req = new RequiredFieldValidator();
                req.ControlToValidate             = this.valueControl;
                req.ControlToValidate.Validating += new CancelEventHandler(ControlToValidate_Validating);
                req.ErrorMessage = "Required.";
                req.IconPadding  = 2;
            }


            this.valueControl.Enabled = !disabled;

            if (this.valueControl.Parent is ComboBoxControl)
            {
                this.valueControl.Parent.Visible = !invisible;
            }
            else
            {
                this.valueControl.Visible = !invisible;
            }
        }
Exemple #18
0
 private void PopulateFields(ControlCollection cc)
 {
     tbSecurityCode   = GetControl("SecurityCode2") as TextBox;
     lblSecurityLabel = GetControl("Label1") as Label;
     lblReturnURL     = GetControl("ReturnURL") as Label;
     lblPwdChgErr     = GetControl("lblPwdChgErr") as Label;
     rfvSecurity      = GetControl("RequiredFieldValidator4") as RequiredFieldValidator;
     cbDoingCheckout  = GetControl("DoingCheckout") as CheckBox;
     hlSignUpLink     = GetControl("SignUpLink") as HyperLink;
     pnlForm          = GetControl("FormPanel") as Panel;
     tbCustomerEmail  = GetControl("CustomerEmail") as TextBox;
     pnlChangePwd     = GetControl("pnlChangePwd") as Panel;
     tbOldPassword    = GetControl("OldPassword") as TextBox;
     tbNewPassword    = GetControl("NewPassword") as TextBox;
     tbNewPassword2   = GetControl("NewPassword2") as TextBox;
 }
Exemple #19
0
        /// <summary>
        /// Gain access to our controls in the template control.
        /// </summary>
        private void AssignLocalPointersToControls()
        {
            _loginTable       = Login1.FindControl("LoginTable") as HtmlTable;
            _userNameCombo    = Login1.FindControl("UserNameComboBox") as RadComboBox;
            _userNameText     = Login1.FindControl("UserName") as TextBox;
            _userValidator    = Login1.FindControl("UserNameRequired") as RequiredFieldValidator;
            _changeButton     = Login1.FindControl("ChangeOrganisationButton") as Button;
            _organisationName = Login1.FindControl("OrganisationName") as Label;
            _loginButton      = Login1.FindControl("LoginButton") as Button;

            _authorisationCodeTable = Login1.FindControl("AuthorisationCodeTable") as HtmlTable;
            _authorisationCode      = Login1.FindControl("AuthorisationCode") as TextBox;
            _updateButton           = Login1.FindControl("UpdateButton") as Button;
            _cancelButton           = Login1.FindControl("CancelButton") as Button;
            _organisationUnique     = Login1.FindControl("OrganisationUnique") as CustomValidator;
        }
Exemple #20
0
    protected void rblidno_type_SelectedIndexChanged(object sender, EventArgs e)
    {
        RadioButtonList        rblidno_type       = (RadioButtonList)FormView_fixA.FindControl("tr_person_fix1").FindControl("rblidno_type");
        RequiredFieldValidator chk_txtperson_fix1 = (RequiredFieldValidator)FormView_fixA.FindControl("tr_person_fix1").FindControl("chk_txtperson_fix1");

        if (rblidno_type.SelectedIndex == 0)
        {
            chk_txtperson_fix1.ErrorMessage = "身分證字號必填";
        }
        else
        {
            chk_txtperson_fix1.ErrorMessage = "護照號碼必填";
        }

        //(FindControl("UpdatePanel_CustomField") as UpdatePanel).Update();
    }
Exemple #21
0
        private void AddTextBox(HtmlTable t, string columnName, string defaultValue, bool isNullable, int maxLength)
        {
            TextBox textBox = this.GetTextBox(columnName + "_textbox", maxLength);
            string  label   = MixERP.Net.Common.Helpers.LocalizationHelper.GetResourceString("FormResource", columnName);

            textBox.Text = defaultValue;

            if (!isNullable)
            {
                RequiredFieldValidator required = GetRequiredFieldValidator(textBox);
                AddRow(t, label + Resources.Setup.RequiredFieldIndicator, textBox, required);
                return;
            }

            AddRow(t, label, textBox);
        }
        private RequiredFieldValidator CreateRequiredFieldValidator(IResourceManager resourceManager)
        {
            RequiredFieldValidator requiredValidator = new RequiredFieldValidator();

            requiredValidator.ID = ID + "_ValidatorRequired";
            requiredValidator.ControlToValidate = TargetControl.ID;
            if (string.IsNullOrEmpty(ErrorMessage))
            {
                requiredValidator.ErrorMessage = resourceManager.GetString(ResourceIdentifier.RequiredValidationMessage);
            }
            else
            {
                requiredValidator.ErrorMessage = ErrorMessage;
            }
            return(requiredValidator);
        }
Exemple #23
0
        private RequiredFieldValidator CreateRequiredFieldValidator()
        {
            var requiredFieldValidator = new RequiredFieldValidator();

            requiredFieldValidator.ID = ID + "_ValidatorNotNullItem";
            requiredFieldValidator.ControlToValidate = ID;
            if (string.IsNullOrEmpty(NullItemErrorMessage))
            {
                requiredFieldValidator.ErrorMessage = GetNullItemErrorMessage();
            }
            else
            {
                requiredFieldValidator.ErrorMessage = NullItemErrorMessage;
            }
            return(requiredFieldValidator);
        }
Exemple #24
0
 protected void rgEnrollmentStatus_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
 {
     if (e.Item.ItemType == GridItemType.FilteringItem)
     {
         GridFilteringItem fileterItem = (GridFilteringItem)e.Item;
         for (int i = 0; i < fileterItem.Cells.Count; i++)
         {
             fileterItem.Cells[i].Style.Add("text-align", "left");
         }
     }
     try
     {
         if (e.Item is GridEditableItem && e.Item.IsInEditMode)
         {
             GridEditableItem item = e.Item as GridEditableItem;
             if (item != null)
             {
                 GridTextBoxColumnEditor editor  = (GridTextBoxColumnEditor)item.EditManager.GetColumnEditor("Status");
                 ImageButton             cmdEdit = (ImageButton)item["Edit"].Controls[0];
                 if (editor != null)
                 {
                     TableCell cell = (TableCell)editor.TextBoxControl.Parent;
                     RequiredFieldValidator validator = new RequiredFieldValidator();
                     if (cell != null)
                     {
                         editor.TextBoxControl.ID    = "Status";
                         validator.ControlToValidate = editor.TextBoxControl.ID;
                         validator.ErrorMessage      = "Please Enter Enrollment Staus\n";
                         validator.SetFocusOnError   = true;
                         validator.Display           = ValidatorDisplay.None;
                     }
                     ValidationSummary validationsum = new ValidationSummary();
                     validationsum.ID             = "validationsum1";
                     validationsum.ShowMessageBox = true;
                     validationsum.ShowSummary    = false;
                     validationsum.DisplayMode    = ValidationSummaryDisplayMode.SingleParagraph;
                     cell.Controls.Add(validator);
                     cell.Controls.Add(validationsum);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.EnrollmentStatus, "rgEnrollmentStatus_ItemCreated", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
     }
 }
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            _rdoAnswer = new RadioButtonList
            {
                ID = "rdo" + _question.QuestionGuid.ToString().Replace("-", String.Empty)
            };

            Label lblQuestion = new Label
            {
                ID                  = "lbl" + _question.QuestionGuid.ToString().Replace("-", String.Empty),
                CssClass            = "settinglabel",
                Text                = _question.QuestionName,
                AssociatedControlID = _rdoAnswer.ID
            };

            Literal litQuestionText = new Literal
            {
                Text = _question.QuestionText
            };

            RequiredFieldValidator valQuestion = new RequiredFieldValidator
            {
                ID   = "val" + _question.QuestionGuid.ToString().Replace("-", String.Empty),
                Text = _question.ValidationMessage,
                ControlToValidate = _rdoAnswer.ID,
                Enabled           = _question.AnswerIsRequired
            };

            foreach (QuestionOption option in _options)
            {
                ListItem li = new ListItem(option.Answer);

                if (li.Value == _answer)
                {
                    li.Selected = true;
                }

                _rdoAnswer.Items.Add(li);
            }

            Controls.Add(lblQuestion);
            Controls.Add(litQuestionText);
            Controls.Add(_rdoAnswer);
            Controls.Add(valQuestion);
        }
Exemple #26
0
    // bootstrappy
    // Takes an input, adds classes, placeholders, and error checking,
    // wraps it in a bootstrappy div, and returns it.
    private HtmlGenericControl bootstrappy(HtmlInputText target, string placeholder, string errorString = "", string errorRegex = "")
    {
        HtmlGenericControl outputDiv = new HtmlGenericControl("div");

        outputDiv.Attributes.Add("class", "form-group");

        Label outLabel = new Label();

        outLabel.Text     = placeholder;
        outLabel.CssClass = "sr-only";
        outputDiv.Controls.Add(outLabel);

        target.Attributes.Add("placeholder", placeholder);
        target.Attributes.Add("class", "form-control");
        outputDiv.Controls.Add(target);

        // If inputs must be validated...
        if (_validate)
        {
            // Make them required
            target.Attributes.Add("required", "required");
            if (errorString.Length > 0)
            {
                // Add a generic "not-empty" validator
                RequiredFieldValidator valid = new RequiredFieldValidator();
                valid.ErrorMessage      = errorString;
                valid.Display           = ValidatorDisplay.Dynamic;
                valid.ControlToValidate = target.ID;
                valid.ForeColor         = System.Drawing.Color.Red;
                outputDiv.Controls.Add(valid);
            }
            if (errorRegex.Length > 0)
            {
                // Add an email-specific vaidator
                RegularExpressionValidator regexval = new RegularExpressionValidator();
                regexval.ErrorMessage         = errorString;
                regexval.Display              = ValidatorDisplay.Dynamic;
                regexval.ValidationExpression = errorRegex;
                regexval.ControlToValidate    = target.ID;
                regexval.ForeColor            = System.Drawing.Color.Red;
                outputDiv.Controls.Add(regexval);
            }
        }

        // Return
        return(outputDiv);
    }
Exemple #27
0
        internal static void AddNumberTextBox(HtmlTable htmlTable, string resourceClassName, string columnName, string defaultValue, bool isSerial, bool isNullable, int maxLength, string domain, string errorCssClass, Assembly assembly, bool disabled)
        {
            if (htmlTable == null)
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(columnName))
            {
                return;
            }

            using (TextBox textBox = ScrudTextBox.GetTextBox(columnName + "_textbox", maxLength))
            {
                using (CompareValidator numberValidator = GetNumberValidator(textBox, domain, errorCssClass))
                {
                    string label = ScrudLocalizationHelper.GetResourceString(assembly, resourceClassName, columnName);

                    if (!string.IsNullOrWhiteSpace(defaultValue))
                    {
                        if (!defaultValue.StartsWith("nextVal", StringComparison.OrdinalIgnoreCase))
                        {
                            textBox.Text = defaultValue;
                        }
                    }

                    if (isSerial)
                    {
                        textBox.ReadOnly = true;
                    }
                    else
                    {
                        if (!isNullable)
                        {
                            using (RequiredFieldValidator required = ScrudFactoryHelper.GetRequiredFieldValidator(textBox, errorCssClass))
                            {
                                ScrudFactoryHelper.AddRow(htmlTable, label + Titles.RequiredFieldIndicator, textBox, numberValidator, required);
                                return;
                            }
                        }
                    }

                    textBox.ReadOnly = disabled;
                    ScrudFactoryHelper.AddRow(htmlTable, label, textBox, numberValidator);
                }
            }
        }
Exemple #28
0
        protected void rgUserGroup_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                GridEditableItem item = e.Item as GridEditableItem;

                if (item != null)
                {
                    TextBox      txtName = item["GroupTitle"].FindControl("txtGroupTitle") as TextBox;
                    DropDownList ddlRole = item["Role"].FindControl("ddlRole") as DropDownList;
                    if (txtName != null)
                    {
                        TableCell cell  = (TableCell)txtName.Parent;
                        TableCell cell1 = (TableCell)ddlRole.Parent;
                        RequiredFieldValidator validator  = new RequiredFieldValidator();
                        RequiredFieldValidator validator1 = new RequiredFieldValidator();
                        if (cell != null)
                        {
                            txtName.ID = "txtGroupTitle";
                            validator.ControlToValidate = txtName.ID;
                            validator.ErrorMessage      = "Please Enter Group Title\n";
                            validator.SetFocusOnError   = true;
                            validator.Display           = ValidatorDisplay.None;
                        }
                        if (cell1 != null)
                        {
                            ddlRole.ID = "ddlRole";
                            validator1.ControlToValidate = ddlRole.ID;
                            validator1.InitialValue      = "00000000-0000-0000-0000-000000000000";
                            validator1.ErrorMessage      = "Please Select Role\n";
                            validator1.SetFocusOnError   = true;
                            validator1.Display           = ValidatorDisplay.None;
                        }

                        ValidationSummary validationsum = new ValidationSummary();
                        validationsum.ID             = "validationsum1";
                        validationsum.ShowMessageBox = true;
                        validationsum.ShowSummary    = false;
                        validationsum.DisplayMode    = ValidationSummaryDisplayMode.SingleParagraph;
                        cell.Controls.Add(validator);
                        cell.Controls.Add(validationsum);
                        cell1.Controls.Add(validator1);
                        cell1.Controls.Add(validationsum);
                    }
                }
            }
        }
Exemple #29
0
        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);
        }
Exemple #30
0
        /// <summary>
        /// Initializes a new insance of the StringControl class.
        /// </summary>
        /// <param name="definition">Definition of the property.</param>
        /// <param name="mode">The current design mode.</param>
        public StringButtonControl(XmlElement definition, string mode)
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();
            //opr = _opr;
            #region Use Standard Sizes

            labelControl.Top   = Property.LabelTop;
            labelControl.Left  = Property.LabelLeft;
            labelControl.Width = Property.LabelWidth;
            valueControl.Top   = Property.ValueTop;
            valueControl.Left  = Property.ValueLeft;
            valueControl.Width = Property.ValueWidth - 25;
            this.Height        = valueControl.Height + Property.PropertyMarginBottom;

            #endregion

            _definition = definition;

            // Initialize control
            Initialize(_definition);
            GetFunctionAndParameters(_definition);
            GetGlobalParameters(_definition);

            labelControl.Text = this.Label;

            valueControl.Text = "";

            /*
             * Height / number of rows.
             */
            labelControl.Height = valueControl.Height;

            /*
             * Check required
             */
            if (IsRequired(_definition, mode) == true)
            {
                req = new RequiredFieldValidator();
                req.ControlToValidate       = this.valueControl;
                req.ErrorMessage            = Resources.GetString(ResourceTokens.ValidatorRequired);
                req.IconPadding             = 2;
                this.valueControl.BackColor = Resources.GetColor("required");
            }
            //_form = new ProgressForm();
            globalData = new Dictionary <string, string>();
        }
Exemple #31
0
    private void handlerSelectedValue(object sender, EventArgs e)
    {
        var ddl             = sender as DropDownList;
        int RequiredFieldId = Convert.ToInt32(ddl.Attributes["RequiredFieldId"]);
        int IdField         = Convert.ToInt32(ddl.Attributes["IdFormField"]);
        int IdForm          = Convert.ToInt32(ddl.Attributes["RequiredFormId"]);

        if (ddl.SelectedIndex > 0)
        {
            ddl.Attributes["SelectedValue"] = "RequiredFieldValidatorForm" + IdForm + "_" + RequiredFieldId;
            FormContext            db  = new FormContext();
            var                    ff  = db.FormFields.Find(IdField);
            RequiredFieldValidator rfv = (RequiredFieldValidator)findControlParent(findControlParent(ddl, "PanelForm" + IdForm), "RequiredFieldValidatorForm" + IdForm + "_" + RequiredFieldId);
            //if(rfv!=null)
            rfv.Enabled = ff.FieldRequiredRelationParents.Count(p => p.IdFormField == IdField && p.ParentIdFormField == IdField && p.IdValue == Convert.ToInt32(ddl.SelectedValue) && !p.Deleted) > 0;
        }
    }
Exemple #32
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         foreach (GridViewRow row in cgvFDCheckList.Rows)
         {
             RequiredFieldValidator rfv = (RequiredFieldValidator)row.FindControl("RequiredFieldValidator1");
             rfv.Enabled = true;
         }
         if (!IsFinalUcOrProvisionalUcExist(Convert.ToInt32(Session["APOFileId"])))
         {
             string strError = ConfigurationManager.AppSettings["UploadProvisionalUc"];
             vmError.Message = strError;
             return;
         }
         if (!CheckApoStatusBeforeAnyAction())
         {
             return;
         }
         if (cgvFDCheckList.Rows.Count > 0)
         {
             SubmitCheckList(cgvFDCheckList);
             string strSuccess = "Checklist saved successfully.";
             vmSuccess.Message = strSuccess;
             FlashMessage.InfoMessage(vmSuccess.Message);
             UserBAL.Instance.InsertAuditTrailDetail("Saved Checklist", "APO");
             LoadCheckListDraftData(cgvFDCheckList);
         }
         else
         {
             string strError = ConfigurationManager.AppSettings["EmptyChecklist"];
             vmError.Message = strError;
             FlashMessage.ErrorMessage(vmError.Message);
             return;
         }
     }
     catch (Exception ex)
     {
         LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
         Response.RedirectPermanent("~/ErrorPage.aspx", false);
         //string strError = ex.Message;
         //vmError.Message = strError;
         //FlashMessage.ErrorMessage(vmError.Message);
         //return;
     }
 }
        public void LoadDetails()
        {
            //Set Validation group
            _validationGroup = SessionHandler.MappingAreaCodeValidationGroup;

            this.ButtonSave.ValidationGroup = _validationGroup;

            foreach (Control cntrl in this.PanelPopupMappingDetails.Controls)
            {
                if (cntrl is TextBox)
                {
                    TextBox txtBox = (TextBox)cntrl;
                    txtBox.ValidationGroup = _validationGroup;
                }
                if (cntrl is RequiredFieldValidator)
                {
                    RequiredFieldValidator reqFieldValidator = (RequiredFieldValidator)cntrl;
                    reqFieldValidator.ValidationGroup = _validationGroup;
                }
                if (cntrl is CustomValidator)
                {
                    CustomValidator custValidator = (CustomValidator)cntrl;
                    custValidator.ValidationGroup = _validationGroup;
                }
                if (cntrl is System.Web.UI.WebControls.DropDownList)
                {
                    System.Web.UI.WebControls.DropDownList ddList = (System.Web.UI.WebControls.DropDownList)cntrl;
                    ddList.ValidationGroup = _validationGroup;
                }
            }

            switch (SessionHandler.MappingAreaCodeDefaultMode)
            {
            case (int)App.BLL.Mappings.Mode.Insert:

                this.LoadInsertMode();

                break;

            case (int)App.BLL.Mappings.Mode.Edit:

                this.LoadEditMode();

                break;
            }
        }
Exemple #34
0
    public void Page_Init(object sender, EventArgs e)
    {
        myTextBox = new TextBox();
        myButton  = new Button();
        myLabel   = new Label();
        myLabel1  = new Label();
        myRequiredFieldValidator = new RequiredFieldValidator();
        myForm = new HtmlForm();

        myForm.Method = "POST";

        // Call the required properties on the controls.
        myTextBox.ID  = "Number";
        myButton.Text = "Submit";
        myRequiredFieldValidator.ControlToValidate = "Number";
        myRequiredFieldValidator.ErrorMessage      = "Number entry is Mandatory.";
    }
Exemple #35
0
// ---------------------------------------------------------------------------
        public static RequiredFieldValidator GetRequiredValidator(
            string ID, string validationGroup
            )
        {
            RequiredFieldValidator rfv = new RequiredFieldValidator();

            rfv.ControlToValidate = ID;
            rfv.ID                 = ID + "_required-validator";
            rfv.Display            = ValidatorDisplay.Dynamic;
            rfv.ErrorMessage       = " Required";
            rfv.EnableClientScript = false;
            if (validationGroup != String.Empty)
            {
                rfv.ValidationGroup = validationGroup;
            }
            return(rfv);
        }
Exemple #36
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.Static;

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

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

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

            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.requiredValidator.SetFocusOnError    = true;

            this.Controls.Add(this.textBox);

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

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

            Net.Common.jQueryHelper.jQueryUI.AddjQueryUIDatePicker(this.Page, textBox.ID, this.MinDate, this.MaxDate);
            base.CreateChildControls();
        }
Exemple #37
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            // create the controls
            this.TextControl = new TextBox()
            {
                ID = "TextId"
            };
            this.RequiredControl = new RequiredFieldValidator()
            {
                ID = "requiredField", ForeColor = Color.Red, ControlToValidate = this.TextControl.ID, ErrorMessage = " Field is required"
            };

            // add the controls
            this.Controls.AddPrevalueControls(this.TextControl, this.RequiredControl);
        }
Exemple #38
0
        public void RenderOnclick5()
        {
            Page page = new Page();

#if NET_2_0
            page.EnableEventValidation = false;
#endif
            RequiredFieldValidator val = new RequiredFieldValidator();
            val.ControlToValidate = "id1";
            page.Validators.Add(val);
            HtmlInputButtonPoker it = new HtmlInputButtonPoker("submit");
            page.Controls.Add(it);
            it.ID           = "id1";
            it.ServerClick += new EventHandler(EmptyHandler);
            string rendered = it.RenderToString();
            Assert.IsTrue(rendered.IndexOf("onclick") != -1, "#01");
        }
Exemple #39
0
        private void ValidateMovimientos(object source, System.Web.UI.WebControls.ServerValidateEventArgs args)
        {
            RequiredFieldValidator     reqMov = (RequiredFieldValidator)this.phValidMovimientoMensual.FindControl("reqMov");
            RegularExpressionValidator valMov = (RegularExpressionValidator)this.phValidMovimientoMensual.FindControl("valMov");

            reqMov.Enabled = true;
            valMov.Enabled = true;
            reqMov.Validate();
            valMov.Validate();
            if (!reqMov.IsValid || !valMov.IsValid)
            {
                args.IsValid = false;
                return;
            }

            args.IsValid = true;
        }
 //these are required field validators for every Not-nullable field in the database table
 protected void AddValidators(DataTable dt)
 {
     int numRows = dt.Rows.Count;
     for (int i = 1; i < numRows; i++)
     {
         if ((string)dt.Rows[i].ItemArray[2] == "NO")
         {
             Label l = new Label();
             l.Text = "*";
             l.ForeColor = Color.Red;
             v1table.Rows[i - 1].Cells[2].Controls.Add(l);
             RequiredFieldValidator rfv = new RequiredFieldValidator();
             TextBox t = (TextBox)v1table.Rows[i - 1].Cells[1].Controls[0];
             rfv.ControlToValidate = t.ID;
             v1table.Rows[i - 1].Cells[2].Controls.Add(rfv);
         }
     }
 }
Exemple #41
0
        /// <summary>
        /// Initializes a new insance of the StringControl class.
        /// </summary>
        /// <param name="definition">Definition of the property.</param>
        /// <param name="mode">The current design mode.</param>
        public RichTextControl(XmlElement definition, string mode)
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();
            //opr = _opr;
            #region Use Standard Sizes

            labelControl.Top = Property.LabelTop;
            labelControl.Left = Property.LabelLeft;
            labelControl.Width = Property.LabelWidth;
            valueControl.Top = Property.ValueTop;
            valueControl.Left = Property.ValueLeft;
            valueControl.Width = Property.ValueWidth;
            this.Height = valueControl.Height + Property.PropertyMarginBottom;
            this.Height = valueControl.Height + Property.PropertyMarginBottom;

            #endregion

            _definition = definition;

            // Initialize control
            Initialize(_definition);

            labelControl.Text = this.Label;

            valueControl.Text = "";

            /*
             * Height / number of rows.
             */
            labelControl.Height = valueControl.Height;

            /*
             * Check required
             */
            if (IsRequired(_definition, mode) == true)
            {
                req = new RequiredFieldValidator();
                req.ControlToValidate = this.valueControl;
                req.ErrorMessage = Resources.GetString(ResourceTokens.ValidatorRequired);
                req.IconPadding = 2;
                valueControl.BackColor = Resources.GetColor("required");
            }
        }
    protected void GenrateFirstName()
    {
        Label lblFrstname = new Label();
        lblFrstname.ID = "lblFrstName";
        lblFrstname.Text = "First Name";
        plcHldrRegsform.Controls.Add(lblFrstname);

        RequiredFieldValidator rqFrstname = new RequiredFieldValidator();
        rqFrstname.ID = "rqFrstName";
        rqFrstname.ControlToValidate = "txtFrstName";
        rqFrstname.ErrorMessage = "Not empty";
        rqFrstname.Text = "*";
        rqFrstname.ForeColor = Color.Red;
        rqFrstname.SetFocusOnError = true;
        rqFrstname.ValidationGroup = "req";
        plcHldrRegsform.Controls.Add(rqFrstname);
        TextBox txtFrstname = new TextBox();
        txtFrstname.ID = "txtFrstName";
        plcHldrRegsform.Controls.Add(txtFrstname);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        submittedGrade.Controls.Add(new LiteralControl("<br/>Comment:<br/>"));
        name.Text = Context.Request["username"];
        comments.TextMode = TextBoxMode.MultiLine;
        comments.Height = 130;
        comments.ID = "commentbox";
        submittedGrade.Controls.Add(comments);

        RequiredFieldValidator rf = new RequiredFieldValidator();
        rf.ControlToValidate = "commentbox";
        rf.ErrorMessage = "Please Enter Comment";
        submittedGrade.Controls.Add(rf);

        Button submit = new Button();
        submit.Text = "Submit";
        submit.Click += this.submitComment;

        submittedGrade.Controls.Add(new LiteralControl("<br/>"));
        submittedGrade.Controls.Add(submit);

        submittedGrade.Controls.Add(new LiteralControl("<br/><br/>"));
    }
Exemple #44
0
        //private OperacoesInternas opr;
        /// <summary>
        /// Initializes a new insance of the ComboBoxControl class.
        /// </summary>
        /// <param name="definition">Definition of the property.</param>
        /// <param name="mode">The current design mode.</param>
        public ComboBoxControl(XmlElement definition, string mode)
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();
            //opr = _opr;
            #region Use Standard Sizes

            labelControl.Top = Property.LabelTop;
            labelControl.Left = Property.LabelLeft;
            labelControl.Width = Property.LabelWidth;
            valueControl.Top =  Property.ValueTop;
            valueControl.Left = Property.ValueLeft;
            valueControl.Width = Property.ValueWidth;

            #endregion

            _definition = definition;

            // Initialize control
            Initialize(_definition);

            labelControl.Text = this.Label;
            valueControl.Items.Clear();

            /*
             * Check required
             */
            if (IsRequired(_definition, mode) == true)
            {
                req = new RequiredFieldValidator();
                req.ControlToValidate = this.valueControl;
                req.ControlToValidate.Validating += new CancelEventHandler(ControlToValidate_Validating);
                req.ErrorMessage = "Required.";
                req.IconPadding = 2;
                this.valueControl.BackColor = Resources.GetColor("required");
            }
        }
Exemple #45
0
		public QuestionText(QuestionBase question, Panel panel)
			: base(question, panel)
		{
			if (question.Hidden)
				return;

			StackPanel responsePanel = base.ResponsePanel;

			bool bMultiLine = (question.Rows > 1);

			m_textBox.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
			responsePanel.Children.Add(m_textBox);
			m_textBox.ApplyStyle(panel, "SurveyTextBox");
			m_textBox.Tag = question.Name;
			m_textBox.Text = " "; // To force the control to have assigned height
//j			if (question.Required)
//j				m_textBox.Watermark = "<Required>";
			m_textBox.AcceptsReturn = bMultiLine;
			m_textBox.TextWrapping = (bMultiLine ? TextWrapping.Wrap : TextWrapping.NoWrap);
			m_textBox.Width = question.Cols * 8 + 12;
			m_textBox.Height = question.Rows * 12 + 12;
			m_textBox.Text = question.ResponseDefault;
			m_textBox.MaxLength = question.MaxChars;
			m_textBox.HorizontalAlignment = HorizontalAlignment.Left;
#if NOTUSED
			if (base.Question.Required)
			{
				RequiredFieldValidator child = new RequiredFieldValidator();
				child.ControlToValidate = m_textBox.Tag;
				child.EnableClientScript = false;
				child.Text = base.Question.RequiredText;
				responsePanel.Children.Add(child);
				responsePanel.Children.Add(new LiteralControl("<br>"));
			}
#endif
		}
    private void CreateControlsInt(int adultCntInt, int ChildCntInt, int infCntInt)
    {
        #region RaviValidations

        try
        {

            #region DomesticFlights
            for (int i = 1; i <= adultCntInt; i++)
            {
                TableRow tr = new TableRow();
                TableCell td1 = new TableCell();
                td1.Text = "Adult" + i;
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(td1);

                TableCell tdSp = new TableCell();
                tdSp.Text = "";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdSp);

                TableCell tdtitle = new TableCell();
                tdtitle.Text = "Title :";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdtitle);

                TableCell td2 = new TableCell();
                DropDownList ddlTitle = new DropDownList();
                ddlTitle.CssClass = "lj_inp";
                ddlTitle.Width = 55;
                ddlTitle.ID = "ddlTitleInt" + i;
                ddlTitle.Items.Add("Mr.");
                ddlTitle.Items.Add("Ms.");
                ddlTitle.Items.Add("Mrs.");
                ddlTitle.Attributes.Add("onchange", "javascript:AddTitle(this);");
                td2.Controls.Add(ddlTitle);
                //td2.Width = Unit.Percentage(25);
                tr.Controls.Add(td2);

                TableCell tdFN = new TableCell();
                tdFN.Text = "FirstName :";

                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdFN);

                TableCell td3 = new TableCell();
                TextBox txtFn = new TextBox();

                txtFn.MaxLength = 20;
                txtFn.CssClass = "lj_inp";
                // txtFn.Width = 110;
                txtFn.ID = "txtFnInt" + i;
                txtFn.Attributes.Add("onkeyup", "javascript:AddLetters(this);");
                td3.Controls.Add(txtFn);
                // td3.Width = Unit.Percentage(25);
                tr.Controls.Add(td3);

                TableCell td6 = new TableCell();
                RequiredFieldValidator rfv2 = new RequiredFieldValidator();

                rfv2.ID = "rfv2" + i;
                rfv2.ControlToValidate = "txtFnInt" + i;
                rfv2.ErrorMessage = "Enter First Name";
                rfv2.Display = ValidatorDisplay.None;

                rfv2.ValidationGroup = "SubmitBook";
                td6.Controls.Add(rfv2);
                tr.Controls.Add(td6);

                TableCell td12 = new TableCell();
                AjaxControlToolkit.FilteredTextBoxExtender fte1 = new AjaxControlToolkit.FilteredTextBoxExtender();
                fte1.ValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz " ;
                fte1.TargetControlID = "txtFnInt" + i;
                td12.Controls.Add(fte1);
                tr.Controls.Add(td12);

                TableCell td7 = new TableCell();
                AjaxControlToolkit.ValidatorCalloutExtender vceFirstName1 = new AjaxControlToolkit.ValidatorCalloutExtender();
                vceFirstName1.ID = "vceFirstName1" + i;
                vceFirstName1.TargetControlID = "rfv2" + i;

                td7.Controls.Add(vceFirstName1);
                tr.Controls.Add(td7);

                TableCell tdLN = new TableCell();
                tdLN.Text = "LastName :";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdLN);

                TableCell td4 = new TableCell();
                TextBox txtLn = new TextBox();
                txtLn.MaxLength = 20;
                txtLn.CssClass = "lj_inp";
                //txtLn.Width = 110;
                txtLn.ID = "txtLnInt" + i;
                txtLn.Attributes.Add("onkeyup", "javascript:AddLettersLn(this);");
                txtLn.Attributes.Add("onchange", "javascript:CheckMinChars(this);");
                td4.Controls.Add(txtLn);
                // td4.Width = Unit.Percentage(25);
                tr.Controls.Add(td4);

                TableCell td5 = new TableCell();
                RequiredFieldValidator rfv1 = new RequiredFieldValidator();
                rfv1.ID = "rfv1" + i;
                rfv1.ControlToValidate = "txtLnInt" + i;
                rfv1.ErrorMessage = "Enter Last Name";
                rfv1.Display = ValidatorDisplay.None;
                rfv1.ValidationGroup = "SubmitBook";
                td5.Controls.Add(rfv1);
                tr.Controls.Add(td5);

                TableCell td8 = new TableCell();
                AjaxControlToolkit.ValidatorCalloutExtender vceLastName1 = new AjaxControlToolkit.ValidatorCalloutExtender();
                vceLastName1.ID = "vceLastName1" + i;
                vceLastName1.TargetControlID = "rfv1" + i;

                td8.Controls.Add(vceLastName1);
                tr.Controls.Add(td8);

                //TableCell td9 = new TableCell();
                //RegularExpressionValidator revLastName = new RegularExpressionValidator();
                //revLastName.ID = "revLastName" + i;
                //revLastName.ControlToValidate = "txtLn" + i;
                //revLastName.ValidationExpression = "^.{2,128}$" + i;
                //revLastName.ErrorMessage="Name Should be Minimum 2 Characters";
                //revLastName.Display=ValidatorDisplay.None;
                //revLastName.ValidationGroup="SubmitBook";
                //td9.Controls.Add(revLastName);
                //tr.Controls.Add(td9);

                //TableCell td9 = new TableCell();
                //RangeValidator rvLastName = new RangeValidator();
                //rvLastName.ID = "rvLastName" + i;
                //rvLastName.ControlToValidate = "txtLn" + i;
                //rvLastName.MinimumValue = "2";
                ////rvLastName.MaximumValue = "20";
                //rvLastName.ErrorMessage = "Name Shold be Minimum 2 Characters";
                //rvLastName.Display = ValidatorDisplay.None;
                //rvLastName.ValidationGroup = "SubmitBook";
                //td9.Controls.Add(rvLastName);
                //tr.Controls.Add(td9);

                //TableCell td10 = new TableCell();
                //AjaxControlToolkit.ValidatorCalloutExtender vceLastName11 = new AjaxControlToolkit.ValidatorCalloutExtender();
                //vceLastName11.ID = "vceLastName11" + i;
                //vceLastName11.TargetControlID = "rvLastName" + i;
                //td10.Controls.Add(vceLastName11);
                //tr.Controls.Add(td10);

                TableCell td13 = new TableCell();
                AjaxControlToolkit.FilteredTextBoxExtender fte2 = new AjaxControlToolkit.FilteredTextBoxExtender();
                fte2.ValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ";
                fte2.TargetControlID = "txtLnInt" + i;
                td12.Controls.Add(fte2);
                tr.Controls.Add(td13);

                tblAdultsInt.Controls.Add(tr);
            }

            for (int i = 1; i <= ChildCntInt; i++)
            {
                TableRow tr = new TableRow();
                TableCell td1 = new TableCell();
                td1.Text = "Child" + i;
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(td1);

                TableCell tdSp = new TableCell();
                tdSp.Text = "";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdSp);

                TableCell tdtitle = new TableCell();
                tdtitle.Text = "Title :";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdtitle);

                TableCell td2 = new TableCell();
                DropDownList ddlTitle = new DropDownList();
                ddlTitle.CssClass = "lj_inp";
                ddlTitle.ID = "ddlCTitleInt" + i;
                ddlTitle.Items.Add("Mstr.");
                ddlTitle.Items.Add("Miss.");
                ddlTitle.Width = 55;

                td2.Controls.Add(ddlTitle);
                //td2.Width = Unit.Percentage(25);
                tr.Controls.Add(td2);

                TableCell tdFN = new TableCell();
                tdFN.Text = "FirstName :";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdFN);

                TableCell td3 = new TableCell();
                TextBox txtFn = new TextBox();
                txtFn.MaxLength = 20;
                txtFn.CssClass = "lj_inp";
                //txtFn.Width = 110;
                txtFn.ID = "txtCFnInt" + i;
                td3.Controls.Add(txtFn);
                // td3.Width = Unit.Percentage(25);
                tr.Controls.Add(td3);

                TableCell tdLN = new TableCell();
                tdLN.Text = "LastName :";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdLN);

                TableCell td4 = new TableCell();
                TextBox txtLn = new TextBox();
                txtLn.MaxLength = 20;
                txtLn.CssClass = "lj_inp";
                //txtLn.Width = 110;
                txtLn.ID = "txtCLnInt" + i;

                td4.Controls.Add(txtLn);
                // td4.Width = Unit.Percentage(25);
                tr.Controls.Add(td4);

                TableCell tdBD = new TableCell();
                tdBD.Text = "DOB :";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdBD);

                TableCell td5 = new TableCell();
                TextBox txtBirthDate = new TextBox();
                txtBirthDate.Attributes.Add("onchange", "javascript:InfantDate(this);");
                txtBirthDate.Attributes.Add("onkeyup", "javascript:Adddob(this);");
                txtBirthDate.CssClass = "lj_inp";
                txtBirthDate.Width = 110;
                txtBirthDate.ID = "txtCBirthDateInt" + i;
                txtBirthDate.AutoPostBack = true;
                txtBirthDate.Attributes.Add("OnTextChanged", "javascript:GetYears(" + txtBirthDate.Text + "," + DateTime.Now + ")");
                td5.Controls.Add(txtBirthDate);

                TableCell td32 = new TableCell();
                RequiredFieldValidator rfv32 = new RequiredFieldValidator();
                rfv32.ID = "rfv32" + i;
                rfv32.ControlToValidate = "txtCBirthDateInt" + i;
                rfv32.ErrorMessage = "Enter Date Of Birth";
                rfv32.Display = ValidatorDisplay.None;
                rfv32.ValidationGroup = "SubmitBook";
                td32.Controls.Add(rfv32);
                tr.Controls.Add(td32);

                TableCell td33 = new TableCell();
                AjaxControlToolkit.ValidatorCalloutExtender vceCFirstName33 = new AjaxControlToolkit.ValidatorCalloutExtender();
                vceCFirstName33.ID = "vceCFirstName33" + i;
                vceCFirstName33.TargetControlID = "rfv32" + i;

                td32.Controls.Add(vceCFirstName33);
                tr.Controls.Add(td33);

                Label lblBirthDate = new Label();
                lblBirthDate.ID = "lblCBirthDateInt" + i;
                lblBirthDate.Text = "eg : 20-Oct-2012";

                td5.Controls.Add(lblBirthDate);
                tr.Controls.Add(td5);

                TableCell td6 = new TableCell();
                AjaxControlToolkit.CalendarExtender calExtChild = new AjaxControlToolkit.CalendarExtender();
                calExtChild.ID = "calExtChild" + i;
                calExtChild.TargetControlID = "txtCBirthDateInt" + i;
                calExtChild.Format = "dd-MMM-yyyy";
                td6.Controls.Add(calExtChild);
                tr.Controls.Add(td6);

                TableCell td7 = new TableCell();
                RequiredFieldValidator rfv7 = new RequiredFieldValidator();
                rfv7.ID = "rfv7" + i;
                rfv7.ControlToValidate = "txtCLnInt" + i;
                rfv7.ErrorMessage = "Enter Last Name";
                rfv7.Display = ValidatorDisplay.None;
                rfv7.ValidationGroup = "SubmitBook";
                td7.Controls.Add(rfv7);
                tr.Controls.Add(td7);

                TableCell td15 = new TableCell();
                AjaxControlToolkit.FilteredTextBoxExtender ftec2 = new AjaxControlToolkit.FilteredTextBoxExtender();
                ftec2.ValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ";
                ftec2.TargetControlID = "txtCLnInt" + i;
                td15.Controls.Add(ftec2);
                tr.Controls.Add(td15);

                TableCell td16 = new TableCell();
                AjaxControlToolkit.ValidatorCalloutExtender vceCFirstName2 = new AjaxControlToolkit.ValidatorCalloutExtender();
                vceCFirstName2.ID = "vceCFirstName2" + i;
                vceCFirstName2.TargetControlID = "rfv7" + i;

                td7.Controls.Add(vceCFirstName2);
                tr.Controls.Add(td7);

                TableCell td8 = new TableCell();
                RequiredFieldValidator rfv8 = new RequiredFieldValidator();
                rfv8.ID = "rfv8" + i;
                rfv8.ControlToValidate = "txtCFnInt" + i;
                rfv8.ErrorMessage = "Enter First Name";
                rfv8.Display = ValidatorDisplay.None;
                rfv8.ValidationGroup = "SubmitBook";
                td8.Controls.Add(rfv8);
                tr.Controls.Add(td8);

                TableCell td13 = new TableCell();
                AjaxControlToolkit.FilteredTextBoxExtender ftec1 = new AjaxControlToolkit.FilteredTextBoxExtender();
                ftec1.ValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ";
                ftec1.TargetControlID = "txtCFnInt" + i;
                td13.Controls.Add(ftec1);
                tr.Controls.Add(td13);

                TableCell td14 = new TableCell();
                AjaxControlToolkit.ValidatorCalloutExtender vceCFirstName1 = new AjaxControlToolkit.ValidatorCalloutExtender();
                vceCFirstName1.ID = "vceCFirstName1" + i;
                vceCFirstName1.TargetControlID = "rfv8" + i;

                td7.Controls.Add(vceCFirstName1);
                tr.Controls.Add(td7);

                tblChildInt.Controls.Add(tr);

            }

            for (int i = 1; i <= infCntInt; i++)
            {
                TableRow tr = new TableRow();
                TableCell td1 = new TableCell();
                td1.Text = "Infant" + i;
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(td1);

                TableCell tdSp = new TableCell();
                tdSp.Text = "";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdSp);

                TableCell tdtitle = new TableCell();
                tdtitle.Text = "Title :";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdtitle);

                TableCell td2 = new TableCell();
                DropDownList ddlTitle = new DropDownList();
                ddlTitle.CssClass = "lj_inp";
                ddlTitle.ID = "ddlITitleInt" + i;
                ddlTitle.Items.Add("Mstr.");
                ddlTitle.Items.Add("Miss.");
                ddlTitle.Width = 55;
                td2.Controls.Add(ddlTitle);
                //td2.Width = Unit.Percentage(25);
                tr.Controls.Add(td2);

                TableCell tdFN = new TableCell();
                tdFN.Text = "FirstName :";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdFN);

                TableCell td3 = new TableCell();
                TextBox txtFn = new TextBox();
                txtFn.MaxLength = 20;
                txtFn.CssClass = "lj_inp";
                // txtFn.Width = 110;
                txtFn.ID = "txtIFnInt" + i;
                td3.Controls.Add(txtFn);
                // td3.Width = Unit.Percentage(25);
                tr.Controls.Add(td3);

                TableCell tdLN = new TableCell();
                tdLN.Text = "LastName :";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdLN);

                TableCell td4 = new TableCell();
                TextBox txtLn = new TextBox();
                txtLn.MaxLength = 20;
                txtLn.CssClass = "lj_inp";
                //txtLn.Width = 110;
                txtLn.ID = "txtILn" + i;
                td4.Controls.Add(txtLn);
                // td4.Width = Unit.Percentage(25);
                tr.Controls.Add(td4);

                TableCell tdBD = new TableCell();
                tdBD.Text = "DOB :";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdBD);

                TableCell td5 = new TableCell();
                TextBox txtBirthDate = new TextBox();
                txtBirthDate.Attributes.Add("onchange", "javascript:InfantDate(this);");
                txtBirthDate.Attributes.Add("onkeyup", "javascript:Adddob(this);");
                txtBirthDate.CssClass = "lj_inp";
                txtBirthDate.Width = 110;
                txtBirthDate.ID = "txtIBirthDate" + i;

                td5.Controls.Add(txtBirthDate);

                TableCell td30 = new TableCell();
                RequiredFieldValidator rfv30 = new RequiredFieldValidator();
                rfv30.ID = "rfv30" + i;
                rfv30.ControlToValidate = "txtIBirthDate" + i;
                rfv30.ErrorMessage = "Enter Date Of Birth";
                rfv30.Display = ValidatorDisplay.None;
                rfv30.ValidationGroup = "SubmitBook";
                td30.Controls.Add(rfv30);
                tr.Controls.Add(td30);

                TableCell td31 = new TableCell();
                AjaxControlToolkit.ValidatorCalloutExtender vceCFirstName31 = new AjaxControlToolkit.ValidatorCalloutExtender();
                vceCFirstName31.ID = "vceCFirstName31" + i;
                vceCFirstName31.TargetControlID = "rfv30" + i;

                td31.Controls.Add(vceCFirstName31);
                tr.Controls.Add(td31);

                Label lblBirthDate = new Label();
                lblBirthDate.ID = "lblIBirthDate" + i;
                lblBirthDate.Text = " eg : 20-Oct-2012";
                td5.Controls.Add(lblBirthDate);

                tr.Controls.Add(td5);
                // txtBirthDate.Attributes.Add("onkeypress", "javascript:return false");

                TableCell td6 = new TableCell();
                AjaxControlToolkit.CalendarExtender calExtInf = new AjaxControlToolkit.CalendarExtender();
                calExtInf.ID = "calExtInf" + i;
                calExtInf.TargetControlID = "txtIBirthDate" + i;
                calExtInf.Format = "dd-MMM-yyyy";
                td6.Controls.Add(calExtInf);
                tr.Controls.Add(td6);

                TableCell td7 = new TableCell();
                RequiredFieldValidator rfv9 = new RequiredFieldValidator();
                rfv9.ID = "rfv9" + i;
                rfv9.ControlToValidate = "txtILn" + i;
                rfv9.ErrorMessage = "Enter Last Name";
                rfv9.Display = ValidatorDisplay.None;
                rfv9.ValidationGroup = "SubmitBook";
                td7.Controls.Add(rfv9);
                tr.Controls.Add(td7);

                TableCell td9 = new TableCell();
                AjaxControlToolkit.FilteredTextBoxExtender fteIc1 = new AjaxControlToolkit.FilteredTextBoxExtender();
                fteIc1.ValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ";
                fteIc1.TargetControlID = "txtILn" + i;
                td9.Controls.Add(fteIc1);
                tr.Controls.Add(td9);

                TableCell td10 = new TableCell();
                AjaxControlToolkit.ValidatorCalloutExtender vceIFirstName1 = new AjaxControlToolkit.ValidatorCalloutExtender();
                vceIFirstName1.ID = "vceIFirstName1" + i;
                vceIFirstName1.TargetControlID = "rfv9" + i;

                td7.Controls.Add(vceIFirstName1);
                tr.Controls.Add(td10);

                TableCell td8 = new TableCell();
                RequiredFieldValidator rfv10 = new RequiredFieldValidator();
                rfv10.ID = "rfv10" + i;
                rfv10.ControlToValidate = "txtIFnInt" + i;
                rfv10.ErrorMessage = "Enter First Name";
                rfv10.Display = ValidatorDisplay.None;
                rfv10.ValidationGroup = "SubmitBook";
                td8.Controls.Add(rfv10);
                tr.Controls.Add(td8);

                TableCell td11 = new TableCell();
                AjaxControlToolkit.FilteredTextBoxExtender fteIc2 = new AjaxControlToolkit.FilteredTextBoxExtender();
                fteIc2.ValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ";
                fteIc2.TargetControlID = "txtIFnInt" + i;
                td9.Controls.Add(fteIc2);
                tr.Controls.Add(td11);

                TableCell td12 = new TableCell();
                AjaxControlToolkit.ValidatorCalloutExtender vceIFirstName2 = new AjaxControlToolkit.ValidatorCalloutExtender();
                vceIFirstName2.ID = "vceIFirstName2" + i;
                vceIFirstName1.TargetControlID = "rfv10" + i;

                td7.Controls.Add(vceIFirstName1);
                tr.Controls.Add(td10);

                tblInfantsInt.Controls.Add(tr);

            }
            #endregion

        }
        catch
        {
        }

        #endregion
    }
Exemple #47
0
    private void BuildImageControls()
    {
        string tableId = "TableImages";
        Control c = UpdatePanelImages.ContentTemplateContainer.FindControl(tableId);
        if (c != null)
            UpdatePanelImages.ContentTemplateContainer.Controls.Remove(c);
        UploadedImages list = UploadedImages.FromSession(RouteName.Value);
        Table table = new Table();
        table.ID = tableId;
        table.Style[HtmlTextWriterStyle.Position] = "relative";
        table.Style[HtmlTextWriterStyle.MarginLeft] = "auto";
        table.Style[HtmlTextWriterStyle.MarginRight] = "auto";
        table.Style[HtmlTextWriterStyle.TextAlign] = "center";
        UpdatePanelImages.ContentTemplateContainer.Controls.Add(table);
        TableRow row = null;

        int col = 0;
        for (int i = 0; i < list.Count; i++)
        {
            UploadedImage ui = list.GetAt(i);
            if (ui.IsDeleted)
                continue;
            if (col == 0)
            {
                row = new TableRow();
                table.Rows.Add(row);
            }

            TableCell cell = new TableCell();
            row.Cells.Add(cell);
            cell.CssClass = "ImageCell";
            cell.Width = Unit.Percentage(33.33333);

            Panel container = new Panel();
            container.Style[HtmlTextWriterStyle.Display] = "inline-block";

            cell.Controls.Add(container);

            string fileName = Path.GetFileName(ui.File);
            if (string.IsNullOrEmpty(mainImage))
                mainImage = fileName;

            MyImageButton ib = new MyImageButton(ui);
            ib.ID = "IB_" + fileName;
            ib.ImageUrl = "~/Images/Recycle.png";
            ib.ToolTip = "Elimina immagine";
            ib.Click += new ImageClickEventHandler(ib_Click);
            ib.CssClass = "DeleteImage";
            ib.CausesValidation = false;
            ib.Attributes["onmouseout"] = "normalDeleteImage(this);";
            ib.Attributes["onmouseover"] = "hoverDeleteImage(this);";

            container.Controls.Add(ib);

            UpdatePanel panel = new UpdatePanel();
            panel.ChildrenAsTriggers = true;
            panel.UpdateMode = UpdatePanelUpdateMode.Conditional;
            container.Controls.Add(panel);

            System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image();
            img.ImageUrl = string.Format("~/RouteImage.axd?Route={0}&Image={1}", RouteName.Value, HttpUtility.UrlEncode(ui.File));
            img.Style[HtmlTextWriterStyle.PaddingLeft] = img.Style[HtmlTextWriterStyle.PaddingRight] = "20px";
            img.Style[HtmlTextWriterStyle.PaddingTop] = "20px";
            panel.ContentTemplateContainer.Controls.Add(img);

            TextBox tb = new TextBox();
            tb.Style[HtmlTextWriterStyle.Display] = "block";
            tb.Width = Unit.Pixel(200);
            tb.ID = "I_" + Path.GetFileName(ui.File);
            tb.Text = ui.Description;
            tb.CausesValidation = true;
            descriptionMap[tb] = ui;
            tb.TextChanged += new EventHandler(tb_TextChanged);
            tb.AutoPostBack = true;
            tb.Style[HtmlTextWriterStyle.MarginLeft] = tb.Style[HtmlTextWriterStyle.MarginRight] = "auto";

            panel.ContentTemplateContainer.Controls.Add(tb);

            RequiredFieldValidator val = new RequiredFieldValidator();
            val.ID = "V_" + tb.ID;
            val.ControlToValidate = tb.ID;
            val.ErrorMessage = "Descrizione immagine obbligatoria!";
            val.SetFocusOnError = true;
            val.Display = ValidatorDisplay.Dynamic;
            panel.ContentTemplateContainer.Controls.Add(val);

            MyRadioButton rb = new MyRadioButton(ui);
            buttons.Add(rb);
            rb.Style[HtmlTextWriterStyle.Display] = "block";
            rb.Width = Unit.Pixel(200);
            rb.ID = "CB_" + fileName;
            rb.Text = "Immagine principale";
            rb.Style[HtmlTextWriterStyle.MarginLeft] = rb.Style[HtmlTextWriterStyle.MarginRight] = "auto";
            rb.Checked = fileName == mainImage;
            rb.CausesValidation = false;
            rb.EnableViewState = true;
            container.Controls.Add(rb);

            if (++col == 3)
                col = 0;
        }
    }
Exemple #48
0
        /// <summary>
        /// Fills the XML form data based on a value.
        /// </summary>
        /// <param name="value"></param>
        public override void Set(string value, bool required, bool disabled, bool invisible, bool forceReplacement)
        {
            if (valueControl.Text.Replace(" ", "").Length <= 0 ||
                (valueControl.Text.Replace(" ", "").Length > 0 && this.Id == "id") || forceReplacement)
                valueControl.Text = value;

            if (required)
            {
                req = new RequiredFieldValidator();
                req.ControlToValidate = this.valueControl;
                req.ErrorMessage = "Required.";
                req.IconPadding = 2;
                this.valueControl.BackColor = Resources.GetColor("required");
            }

            this.valueControl.Enabled = !disabled;

            if (this.valueControl.Parent is StringControl)
                this.valueControl.Parent.Visible = !invisible;
            else
                this.valueControl.Visible = !invisible;
        }
Exemple #49
0
        /// <summary>
        /// Fills the XML form data based on the serialization data.
        /// </summary>
        /// <param name="element">Element serialization.</param>
        public void Set(XmlElement element)
        {
            valueControl.Items.Clear();

            foreach (XmlElement el in element.SelectNodes(this.ItemName))
            {
                valueControl.Items.Add(new ListItemsObject(el, ComplexLabel, ComplexPattern, childPattern));
            }

            if (IsRequired(_definition, _mode))
            {
                req = new RequiredFieldValidator();
                req.ControlToValidate = this.valueControl;
                req.ControlToValidate.Validating += new CancelEventHandler(ControlToValidate_Validating);
                req.ErrorMessage = "Required.";
                req.IconPadding = 2;
            }
        }
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            // Do nothing
        }
        else
        {
            // WAI validation
            lblUserName = (LocalizedLabel)loginElem.FindControl("lblUserName");
            if (lblUserName != null)
            {
                lblUserName.Text = GetString("general.username");
                if (!ShowUserNameLabel)
                {
                    lblUserName.Attributes.Add("style", "display: none;");
                }
            }
            lblPassword = (LocalizedLabel)loginElem.FindControl("lblPassword");
            if (lblPassword != null)
            {
                lblPassword.Text = GetString("general.password");
                if (!ShowPasswordLabel)
                {
                    lblPassword.Attributes.Add("style", "display: none;");
                }
            }

            // Set properties for validator
            rfv = (RequiredFieldValidator)loginElem.FindControl("rfvUserNameRequired");
            rfv.ErrorMessage = GetString("edituser.erroremptyusername");
            rfv.ToolTip = GetString("edituser.erroremptyusername");
            rfv.ValidationGroup = ClientID + "_MiniLogon";

            // Set failure text
            if (!string.IsNullOrEmpty(FailureText))
            {
                loginElem.FailureText = ResHelper.LocalizeString(FailureText);
            }
            else
            {
                loginElem.FailureText = GetString("Login_FailureText");
            }

            // Set visibility of buttons
            login = (LocalizedButton)loginElem.FindControl("btnLogon");
            if (login != null)
            {
                login.Visible = !ShowImageButton;
                login.ValidationGroup = ClientID + "_MiniLogon";
            }

            loginImg = (ImageButton)loginElem.FindControl("btnImageLogon");
            if (loginImg != null)
            {
                loginImg.Visible = ShowImageButton;
                loginImg.ImageUrl = ImageUrl;
                loginImg.ValidationGroup = ClientID + "_MiniLogon";
            }

            // Ensure display control as inline and is used right default button
            container = (Panel)loginElem.FindControl("pnlLogonMiniForm");
            if (container != null)
            {
                container.Attributes.Add("style", "display: inline;");
                if (ShowImageButton)
                {
                    if (loginImg != null)
                    {
                        container.DefaultButton = loginImg.ID;
                    }
                    else if (login != null)
                    {
                        container.DefaultButton = login.ID;
                    }
                }
            }

            CMSTextBox txtUserName = (CMSTextBox)loginElem.FindControl("UserName");
            if (txtUserName != null)
            {
                txtUserName.EnableAutoComplete = SecurityHelper.IsAutoCompleteEnabledForLogin(CMSContext.CurrentSiteName);
            }

            if (!string.IsNullOrEmpty(UserNameText))
            {
                // Initialize javascript for focus and blur UserName textbox
                user = (TextBox)loginElem.FindControl("UserName");
                user.Attributes.Add("onfocus", "MLUserFocus_" + ClientID + "('focus');");
                user.Attributes.Add("onblur", "MLUserFocus_" + ClientID + "('blur');");
                string focusScript = "function MLUserFocus_" + ClientID + "(type)" +
                                     "{" +
                                     "var userNameBox = document.getElementById('" + user.ClientID + "');" +
                                     "if(userNameBox.value == '" + UserNameText + "' && type == 'focus')" +
                                     "{userNameBox.value = '';}" +
                                     "else if (userNameBox.value == '' && type == 'blur')" +
                                     "{userNameBox.value = '" + UserNameText + "';}" +
                                     "}";

                ScriptHelper.RegisterClientScriptBlock(this, GetType(), "MLUserNameFocus_" + ClientID,
                                                       ScriptHelper.GetScript(focusScript));
            }
            loginElem.LoggedIn += loginElem_LoggedIn;
            loginElem.LoggingIn += loginElem_LoggingIn;
            loginElem.LoginError += loginElem_LoginError;

            if (!RequestHelper.IsPostBack())
            {
                // Set SkinID properties
                if (!StandAlone && (PageCycle < PageCycleEnum.Initialized) && (ValidationHelper.GetString(Page.StyleSheetTheme, string.Empty) == string.Empty))
                {
                    SetSkinID(SkinID);
                }
            }

            if (string.IsNullOrEmpty(loginElem.UserName))
            {
                loginElem.UserName = UserNameText;
            }

            // Register script to update logon error message
            Label failureLit = loginElem.FindControl("FailureText") as Label;
            if (failureLit != null)
            {
                StringBuilder sbScript = new StringBuilder();
                sbScript.Append(@"
        function UpdateLabel_", ClientID, @"(content, context) {
        var lbl = document.getElementById(context);
        if(lbl)
        {
        lbl.innerHTML = content;
        lbl.className = ""InfoLabel"";
        }
        }");
                ScriptHelper.RegisterClientScriptBlock(this, GetType(), "InvalidLogonAttempts_" + ClientID, sbScript.ToString(), true);
            }
        }
    }
Exemple #51
0
        /// <summary>
        /// Initializes a new insance of the StringControl class.
        /// </summary>
        /// <param name="definition">Definition of the property.</param>
        /// <param name="mode">The current design mode.</param>
        public ItemListControl(XmlElement definition, string mode,Page _page)
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();
            page = _page;
            //opr = _opr;
            _mode = mode;
            _definition = definition;
            #region Use Standard Sizes

            labelControl.Top = Property.LabelTop;
            labelControl.Left = Property.LabelLeft;
            labelControl.Width = Property.LabelWidth;
            valueControl.Top = Property.ValueTop;
            valueControl.Left = Property.ValueLeft;

            //valueControl.Width = Property.ValueWidth;
            this.Height = valueControl.Height + Property.PropertyMarginBottom;
            this.Height = valueControl.Height + Property.PropertyMarginBottom;

            #endregion

            // Initialize control
            Initialize(definition);

            XmlAttribute itemAttribute = definition.Attributes["itemType"];
            if (itemAttribute != null)
            {
                ItemType = itemAttribute.Value;
            }
            itemAttribute = definition.Attributes["itemName"];
            if (itemAttribute != null)
            {
                ItemName = itemAttribute.Value;
            }
            itemAttribute = definition.Attributes["complexLabel"];
            if (itemAttribute != null)
            {
                ComplexLabel = itemAttribute.Value;
            }
            itemAttribute = definition.Attributes["complexPattern"];
            if (itemAttribute != null)
            {
                ComplexPattern = itemAttribute.Value;
            }
            itemAttribute = definition.Attributes["processType"];
            if (itemAttribute != null)
            {
                processShape = bool.Parse(itemAttribute.Value);
            }

            itemAttribute = definition.Attributes["childPattern"];
            if (itemAttribute != null)
            {
                childPattern = itemAttribute.Value;
            }

            labelControl.Text = this.Label;
            valueControl.Text = "";

            /*
             * Height / number of rows.
             */
            labelControl.Height = valueControl.Height;

            /*
             * Check required
             */
            if (IsRequired(definition, mode) == true)
            {
                req = new RequiredFieldValidator();
                req.ControlToValidate = this.valueControl;
                req.ControlToValidate.Validating += new CancelEventHandler(ControlToValidate_Validating);
                req.ErrorMessage = "Required.";
                req.IconPadding = 2;
            }
        }
    protected void rbreturnsearch_CheckedChanged(object sender, EventArgs e)
    {
        txtretundatesearch.Enabled = true;
        txtretundatesearch.Attributes.Add("class", "datepicker");
        Oneway.Visible = false;
        trroundTrip.Visible = true;
        round.Visible = false;
        Returnway.Visible = true;
        Returnwayfare.Visible = true;
        //gdvFlights.Visible = false;
        printroundtrip.Visible = true;

        Tr1.Visible = false;
        tblOnwardFlightDet.Visible = false;
        tblReturnFlightDet.Visible = false;
        FilterBlock.Visible = true;
        trfiltersearch1.Visible = false;

        TableRow tr = new TableRow();

        TableCell td6 = new TableCell();
        RequiredFieldValidator rfv2 = new RequiredFieldValidator();

        rfv2.ControlToValidate = "txtretundatesearch";
        rfv2.ErrorMessage = "Enter Return Date";
        rfv2.Display = ValidatorDisplay.Dynamic;

        rfv2.ValidationGroup = "SearchInt";
        td6.Controls.Add(rfv2);
        tr.Controls.Add(td6);
    }
Exemple #53
0
        /// <summary>
        /// Fills the XML form data based on a value.
        /// </summary>
        /// <param name="value"></param>
        public override void Set(string value, bool required, bool disabled, bool invisible, bool forceReplacement)
        {
            EnsureDataBind();

            ComboBoxObject cgi;
            bool found = false;
            int i, len = valueControl.Items.Count;

            if (valueControl.Text.Replace(" ", "").Length == 0 || forceReplacement)
            {
                for (i = 0; i < len; i++)
                {
                    cgi = (ComboBoxObject)valueControl.Items[i];
                    if (value == cgi.Code)
                    {
                        valueControl.SelectedIndex = i;
                        i = len;
                        found = true;
                    }
                }
                if (found == false)
                {
                    valueControl.SelectedIndex = -1;
                    valueControl.Text = value;
                }
            }

            if (required)
            {
                req = new RequiredFieldValidator();
                req.ControlToValidate = this.valueControl;
                req.ControlToValidate.Validating += new CancelEventHandler(ControlToValidate_Validating);
                req.ErrorMessage = "Required.";
                req.IconPadding = 2;
            }

            this.valueControl.Enabled = !disabled;

            if (this.valueControl.Parent is ComboBoxControl)
                this.valueControl.Parent.Visible = !invisible;
            else
                this.valueControl.Visible = !invisible;
        }
 private void GenrateSageSerchForm()
 {
     try
     {
         if (pnlSearchWord.Controls.Count == 1)
         {
             SageFrameSearch con = new SageFrameSearch();
             SageFrameSearchSettingInfo objSearchSettingInfo = con.LoadSearchSettings(GetPortalID, GetCurrentCultureName);
             viewPerPage = objSearchSettingInfo.SearchResultPerPage;
             HtmlGenericControl sageUl = new HtmlGenericControl("ul");
             sageUl.Attributes.Add("class", "sfSearchheader");
             HtmlGenericControl sageLi = new HtmlGenericControl("li");
             sageUl.Attributes.Add("class", "sfSearchheader");
             TextBox txtSageSearch = new TextBox();
             txtSageSearch.CssClass = "sfInputbox";
             txtSageSearch.MaxLength = objSearchSettingInfo.MaxSearchChracterAllowedWithSpace;
             IDOfTxtBox = "txtSage_" + this.Page.Controls.Count.ToString();
             txtSageSearch.ID = IDOfTxtBox;
             RequiredFieldValidator ReqV = new RequiredFieldValidator();
             ReqV.ControlToValidate = IDOfTxtBox;
             ReqV.ErrorMessage = "*";
             ReqV.CssClass = "sfError";
             ReqV.ValidationGroup = "grp_SageSearch";
             sageLi.Controls.Add(ReqV);
             sageLi.Controls.Add(txtSageSearch);
             HtmlGenericControl sageLiButton = new HtmlGenericControl("li");
             string SearchReasultPageName = objSearchSettingInfo.SearchResultPageName;
             if (!SearchReasultPageName.Contains(SageFrameSettingKeys.PageExtension))
             {
                 SearchReasultPageName += SageFrameSettingKeys.PageExtension;
             }
             SageSearchResultPage = SearchReasultPageName;
             if (objSearchSettingInfo.SearchButtonType == 0)
             {
                 Button btnSageSearch = new Button();
                 btnSageSearch.ID = "btnSageSearchWord";
                 btnSageSearch.Text = "Search";
                 btnSageSearch.CssClass = "sfBtn";
                 btnSageSearch.Click += new EventHandler(btnSageSearch_Click);
                 btnSageSearch.ValidationGroup = "grp_SageSearch_" + SageUserModuleID.ToString();
                 sageLiButton.Controls.Add(btnSageSearch);
             }
             else if (objSearchSettingInfo.SearchButtonType == 1)
             {
                 ImageButton btnSageSearch = new ImageButton();
                 btnSageSearch.ID = "btnSageSearchWord";
                 btnSageSearch.AlternateText = objSearchSettingInfo.SearchButtonText;
                 string SearchButtonImageUrl = objSearchSettingInfo.SearchButtonImage;
                 btnSageSearch.ImageUrl = GetTemplateImageUrl(SearchButtonImageUrl, true);
                 btnSageSearch.CssClass = "sfBtn";
                 btnSageSearch.ValidationGroup = "grp_SageSearch_" + SageUserModuleID.ToString();
                 btnSageSearch.Click += new ImageClickEventHandler(btnSageSearch_Click);
                 sageLiButton.Controls.Add(btnSageSearch);
             }
             else if (objSearchSettingInfo.SearchButtonType == 2)
             {
                 LinkButton btnSageSearch = new LinkButton();
                 btnSageSearch.ID = "btnSageSearchWord";
                 btnSageSearch.Text = "Search";
                 //btnSageSearch.CssClass = "sfBtn";
                 btnSageSearch.Click += new EventHandler(btnSageSearch_Click);
                 btnSageSearch.ValidationGroup = "grp_SageSearch_" + SageUserModuleID.ToString();
                 sageLiButton.Controls.Add(btnSageSearch);
             }
             sageUl.Controls.Add(sageLi);
             sageUl.Controls.Add(sageLiButton);
             pnlSearchWord.Controls.Add(sageUl);
         }
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
		public void SetUp() {
			IServices services = new Services(Meta, DataConnector);
			validator = new RequiredFieldValidator(Meta, services);
		}
Exemple #56
0
        /// <summary>
        /// Fills the XML form data based on a value.
        /// </summary>
        /// <param name="value"></param>
        public override void Set(string value, bool required, bool disabled, bool invisible, bool forceReplacement)
        {
            bool b = false;

            if (!userSelected || forceReplacement)
            {
                if (value == TrueString)
                    b = true;
                else if (value == FalseString)
                    b = false;

                valueControl.Checked = b;
            }

            if (required)
            {
                req = new RequiredFieldValidator();
                req.ControlToValidate = this.valueControl;
                req.ErrorMessage = "Required.";
                req.IconPadding = 2;
            }

            this.valueControl.Enabled = !disabled;

            if (this.valueControl.Parent is CheckBoxControl)
                this.valueControl.Parent.Visible = !invisible;
            else
                this.valueControl.Visible = !invisible;
        }
    protected void v2next_Click(object sender, EventArgs e)
    {
        bool valid = true;

        //validate v2table controls
        for (int i = 1; i < v2table.Rows.Count; i++)
        {
            DropDownList ddl = (DropDownList)v2table.Rows[i].Cells[1].Controls[0];
            TextBox t = (TextBox)v2table.Rows[i].Cells[0].Controls[0];

            RequiredFieldValidator rfv = new RequiredFieldValidator();
            rfv.ErrorMessage = "Fill the text box and choose from the drop list";
            rfv.ControlToValidate = v2table.Rows[i].Cells[0].Controls[0].ID; //the ID of the textbox in the first cell
            v2table.Rows[i].Cells[3].Controls.Add(rfv);

            if (t.Text.Trim().Length < 1 || ddl.SelectedIndex == 0)
            {
                rfv.IsValid = false;
                valid = false;
            }
        }
        if (valid)
        {
            MultiView1.ActiveViewIndex = 2;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        SuperForm1 = new SuperForm();
        SuperForm1.ID = "SuperForm1";
        SuperForm1.DataSourceID = "SqlDataSource1";
        SuperForm1.AutoGenerateRows = false;
        SuperForm1.AutoGenerateInsertButton = true;
        SuperForm1.AutoGenerateEditButton = true;
        SuperForm1.AutoGenerateDeleteButton = true;
        SuperForm1.DataKeyNames = new string[] { "EmployeeID" };
        SuperForm1.AllowPaging = true;
             
        SuperForm1.ValidationGroup = "Group1";
        SuperForm1.DefaultMode = DetailsViewMode.Insert;
        SuperForm1.ItemCommand += SuperForm1_ItemCommand;

        Obout.SuperForm.BoundField field1 = new Obout.SuperForm.BoundField();
        field1.DataField = "EmployeeID";
        field1.HeaderText = "Employee ID";
        field1.ReadOnly = true;
        field1.InsertVisible = false;

        RequiredFieldValidator field2Required = new RequiredFieldValidator();
        field2Required.ID = "FirstNameValidator";
        field2Required.Display = ValidatorDisplay.None;
        field2Required.ErrorMessage = "First Name is mandatory";

        ValidatorCalloutExtender field2CalloutExtender = new ValidatorCalloutExtender();
        field2CalloutExtender.ID = "FirstNameValidatorCallout";
        field2CalloutExtender.TargetControlID = "FirstNameValidator";
        field2CalloutExtender.Width = 250;
        field2CalloutExtender.HighlightCssClass = "highlight";
        field2CalloutExtender.WarningIconImageUrl = "resources/icons/warning.gif";
        field2CalloutExtender.CloseImageUrl = "resources/icons/close.gif";

        Obout.SuperForm.BoundField field2 = new Obout.SuperForm.BoundField();
        field2.DataField = "FirstName";
        field2.HeaderText = "First Name";
        field2.Validators.Add(field2Required);
        field2.Validators.Add(field2CalloutExtender);

        RequiredFieldValidator field3Required = new RequiredFieldValidator();
        field3Required.ID = "LastNameValidator";
        field3Required.Display = ValidatorDisplay.None;
        field3Required.ErrorMessage = "Last Name is mandatory";
        field3Required.Text = "*";

        ValidatorCalloutExtender field3CalloutExtender = new ValidatorCalloutExtender();
        field3CalloutExtender.ID = "LastNameValidatorCallout";
        field3CalloutExtender.TargetControlID = "LastNameValidator";
        field3CalloutExtender.Width = 250;
        field3CalloutExtender.HighlightCssClass = "highlight";
        field3CalloutExtender.WarningIconImageUrl = "resources/icons/warning.gif";
        field3CalloutExtender.CloseImageUrl = "resources/icons/close.gif";

        Obout.SuperForm.BoundField field3 = new Obout.SuperForm.BoundField();
        field3.DataField = "LastName";
        field3.HeaderText = "Last Name";
        field3.Validators.Add(field3Required);
        field3.Validators.Add(field3CalloutExtender);

        RequiredFieldValidator field4Required = new RequiredFieldValidator();
        field4Required.ID = "TitleOfCourtesyValidator1";
        field4Required.Display = ValidatorDisplay.None;
        field4Required.ErrorMessage = "Courtesy Title is mandatory";
        field4Required.Text = "*";

        ValidatorCalloutExtender field4Callout1 = new ValidatorCalloutExtender();
        field4Callout1.ID = "TitleOfCourtesyValidatorCallout1";
        field4Callout1.TargetControlID = "TitleOfCourtesyValidator1";
        field4Callout1.Width = 250;
        field4Callout1.HighlightCssClass = "highlight";
        field4Callout1.WarningIconImageUrl = "resources/icons/warning.gif";
        field4Callout1.CloseImageUrl = "resources/icons/close.gif";

        CustomValidator field4Custom = new CustomValidator();
        field4Custom.ID = "TitleOfCourtesyValidator2";
        field4Custom.ServerValidate += ValidateTitle;
        field4Custom.Display = ValidatorDisplay.Dynamic;
        field4Custom.ErrorMessage = "Courtesy Title needs to be 'Mr.', 'Ms.', 'Mrs.' or 'Dr.'";
        field4Custom.Text = "Courtesy Title needs to be 'Mr.', 'Ms.', 'Mrs.' or 'Dr.'";

        Obout.SuperForm.BoundField field4 = new Obout.SuperForm.BoundField();
        field4.DataField = "TitleOfCourtesy";
        field4.HeaderText = "Courtesy Title";
        field4.Validators.Add(field4Required);
        field4.Validators.Add(field4Callout1);
        field4.Validators.Add(field4Custom);

        RequiredFieldValidator field5Required = new RequiredFieldValidator();
        field5Required.ID = "BirthDateValidator1";
        field5Required.Display = ValidatorDisplay.None;
        field5Required.ErrorMessage = "Birth Date is mandatory";
        field5Required.Text = "*";

        ValidatorCalloutExtender field5Callout1 = new ValidatorCalloutExtender();
        field5Callout1.ID = "BirthDateValidatorCallout1";
        field5Callout1.TargetControlID = "BirthDateValidator1";
        field5Callout1.Width = 250;
        field5Callout1.HighlightCssClass = "highlight";
        field5Callout1.WarningIconImageUrl = "resources/icons/warning.gif";
        field5Callout1.CloseImageUrl = "resources/icons/close.gif";

        RangeValidator field5Range = new RangeValidator();
        field5Range.ID = "BirthDateValidator2";
        field5Range.Display = ValidatorDisplay.None;
        field5Range.MinimumValue = "1900/1/1";
        field5Range.MaximumValue = "2039/12/31";
        field5Range.Type = ValidationDataType.Date;
        field5Range.ErrorMessage = "Birth Date needs to be in this format: mm/dd/yyyy";
        field5Range.Text = "*";

        ValidatorCalloutExtender field5Callout2 = new ValidatorCalloutExtender();
        field5Callout2.ID = "BirthDateValidatorCallout2";
        field5Callout2.TargetControlID = "BirthDateValidator2";
        field5Callout2.Width = 250;
        field5Callout2.HighlightCssClass = "highlight";
        field5Callout2.WarningIconImageUrl = "resources/icons/warning.gif";
        field5Callout2.CloseImageUrl = "resources/icons/close.gif";

        Obout.SuperForm.DateField field5 = new Obout.SuperForm.DateField();
        field5.DataField = "BirthDate";
        field5.HeaderText = "Birth Date";
        field5.DataFormatString = "{0:MM/dd/yyyy}";
        field5.ApplyFormatInEditMode = true;
        field5.Validators.Add(field5Required);
        field5.Validators.Add(field5Callout1);
        field5.Validators.Add(field5Range);
        field5.Validators.Add(field5Callout2);

        RequiredFieldValidator field6Required = new RequiredFieldValidator();
        field6Required.ID = "HomePhoneValidator1";
        field6Required.Display = ValidatorDisplay.None;
        field6Required.ErrorMessage = "Home Phone is mandatory";
        field6Required.Text = "*";

        ValidatorCalloutExtender field6Callout1 = new ValidatorCalloutExtender();
        field6Callout1.ID = "HomePhoneValidatorCallout1";
        field6Callout1.TargetControlID = "HomePhoneValidator1";
        field6Callout1.Width = 250;
        field6Callout1.HighlightCssClass = "highlight";
        field6Callout1.WarningIconImageUrl = "resources/icons/warning.gif";
        field6Callout1.CloseImageUrl = "resources/icons/close.gif";

        RegularExpressionValidator field6Range = new RegularExpressionValidator();
        field6Range.ID = "HomePhoneValidator2";
        field6Range.Display = ValidatorDisplay.None;
        field6Range.ValidationExpression = "^(\\(?\\s*\\d{3}\\s*[\\)\\-\\.]?\\s*)?[1-9]\\d{2}\\s*[\\-\\.]\\s*\\d{4}$";
        field6Range.ErrorMessage = "Home Phone must be in this format (###) ###-####";
        field6Range.Text = "*";

        ValidatorCalloutExtender field6Callout2 = new ValidatorCalloutExtender();
        field6Callout2.ID = "HomePhoneValidatorCallout2";
        field6Callout2.TargetControlID = "HomePhoneValidator2";
        field6Callout2.Width = 250;
        field6Callout2.HighlightCssClass = "highlight";
        field6Callout2.WarningIconImageUrl = "resources/icons/warning.gif";
        field6Callout2.CloseImageUrl = "resources/icons/close.gif";

        Obout.SuperForm.BoundField field6 = new Obout.SuperForm.BoundField();
        field6.DataField = "HomePhone";
        field6.HeaderText = "Home Phone";
        field6.Validators.Add(field6Required);
        field6.Validators.Add(field6Callout1);
        field6.Validators.Add(field6Range);
        field6.Validators.Add(field6Callout2);

        SuperForm1.Fields.Add(field1);
        SuperForm1.Fields.Add(field2);
        SuperForm1.Fields.Add(field3);
        SuperForm1.Fields.Add(field4);
        SuperForm1.Fields.Add(field5);
        SuperForm1.Fields.Add(field6);

        SuperForm1Container.Controls.Add(SuperForm1);
    }