public DynamicTextBox(DynamicTextBoxXml xml)
        {
            _textBox = new TextBox();
            _textBox.CausesValidation = false;

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

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

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

            this.controlXML = xml;

            this.Visible = xml.Visible;
        }
        public DynamicTextBox()
        {
            _textBox = new TextBox();
            _textBox.CausesValidation = false;

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

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

            this.controlXML = new DynamicTextBoxXml();
        }
Exemplo n.º 3
0
        private DynamicFieldsAggregator CreateAggregatorForSpecificCustomerInfo(IList<int> selectedCustomerInfoType)
        {
            List<CS_CustomerSpecificInfoType> customerSpecificType = _customerSpecificInfoTypeRepository.ListAll(e => e.Active && selectedCustomerInfoType.Contains(e.ID)).ToList();

            DynamicFieldsAggregator aggregator = new DynamicFieldsAggregator();

            for (int i = 0; i < customerSpecificType.Count; i++)
            {
                DynamicLabel label = new DynamicLabel();
                label.Text = customerSpecificType[i].Description + ":";
                label.Css = "dynamicLabel";

                string controlName = StringManipulation.RemoveSpecialCharactersForControlName("txt" + customerSpecificType[i].Description.Replace(" ", ""));

                DynamicTextBoxXml textbox = new DynamicTextBoxXml("", controlName, false, "", "", 255, label, "input", "", true);
                textbox.CustomerSpecificInfoTypeID = customerSpecificType[i].ID;
                aggregator.Controls.Add(textbox);
            }

            return aggregator;
        }