Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Beginning Ajax with ASP.NET- P23:Thank you for purchasing Beginning Ajax with ASP.NET. We know that you have a lot of options when selecting a programming book and are glad that you have chosen ours. We’re sure you will be pleased with the relevant content and high quality you have come to expect from the Wrox Press line of books. | Chapter 11 textBox targetElement textboxRequired validators requiredFieldValidator errorMessage You must enter some text. typeValidator type Number errorMessage You must enter a valid number. rangeValidator lowerBound 10 upperBound 20 errorMessage You must enter a number between 10 and 20. validators textBox validationErrorLabel targetElement valRequired associatedControl textboxRequired validationGroup id formGroup targetElement formGroup associatedControls reference component textboxValue reference component textboxRequired associatedControls validationGroup label targetElement lblValid visibilityMode Collapse bindings binding dataContext formGroup dataPath isValid property visible bindings label label targetElement lblInValid bindings binding dataContext formGroup dataPath isValid property visible transform Invert binding dataContext lblInValid dataPath text property text transform onValidGroup bindings label components page script How It Works In this example take note of several things Two div tags have been added. The IDs for the div tags are lblValid which contains the text to display when all validators are satisfied with the input and lbllnValid which contains the text to display when one or more validators are invalid. A validationGroup has been defined in the xml-script section. The validation group defines the controls that will be validated together. The lblValid and lbllnValid tags have been added to the xml-script section. Aset of bindings is defined for each. Figure 11-6 shows the output of the group validation process. 306 Atlas Controls Figure 11-6 Why would you want to group validators together Obviously each individual validator will fire. However there may be situations where the validation should be done together. For example it would be valuable for checking required fields when a user signs up for a new service. This is what the validationGroup control in Atlas is for. Behaviors A behavior is the name of the set of actions that can be .