protected override void OnInit(EventArgs e) { base.OnInit(e); Controls.Clear(); /* ignore validation if control **NOT** enabled */ if (!this.Enabled) { return; } /* add RequiredFieldValidator */ if (required) { _rfv = ControlFactory.GetRequiredValidator( this.ID, this.ValidationGroup ); Controls.Add(_rfv); } /* add RegularExpressionValidator */ if (!String.IsNullOrEmpty(regex)) { addRegexValidator(); } /* * client-side JavaScript character counter; **MUST** edit plugin file * to call on all server control(s) */ if (TextMode == TextBoxMode.MultiLine && MaxLength > 0) { Attributes.Add(ControlFactory.MAXLENGTH_ATTR, MaxLength.ToString()); Type cstype = this.GetType(); ClientScriptManager cs = Page.ClientScript; // verify web.config <appSettings> keys exist if (!string.IsNullOrEmpty(_jsPath)) { if (!cs.IsClientScriptBlockRegistered(cstype, _jsPath)) { Literal l = new Literal() { Text = String.Format(StringFormat.TAG_SCRIPT, _jsPath) }; Page.Header.Controls.Add(l); cs.RegisterClientScriptBlock(cstype, _jsPath, ""); } } } /* add CompareValidator */ AddCompareValidator(); /* client-side validation => ValidationGroup */ if (ValidationGroup != String.Empty) { Attributes.Add(ControlFactory.VALIDATION_GROUP_ATTR, ValidationGroup); } }
// ---------------------------------------------------------------------------- protected override void OnInit(EventArgs e) { base.OnInit(e); // ignore validation if control is **NOT** enabled if (!this.Enabled) { return; } if (required) { _rfv = ControlFactory.GetRequiredValidator( this.ID, this.ValidationGroup ); Controls.Add(_rfv); } // client-side validation => ValidationGroup if (ValidationGroup != String.Empty) { Attributes.Add(ControlFactory.VALIDATION_GROUP_ATTR, ValidationGroup); } }