|
ValidatorEntryAndFull pathMadWidgets.Validation.ValidatorEntryAnd
Declarationpublic class ValidatorEntryAnd : ValidatorEntryMultipleEntry
HierarchyClick on the selected class to view any properties or methods that may be accessible through an instance of this class through inheritance.ValidatorEntryAnd
OverviewThe ValidatorEntryAnd class is used to represent the logical "AND"ing of the results of two or more validation entries.In the following example, two ValidatorEntryAnd objects are getting added to a ValidatorEntryOr object, which in turn is getting added to the Validator control. <script runat="server">
void Page_Load(object o, EventArgs ea)
{
Validator v = Validator.Current;
v.Add(new ValidatorEntryRequired(SearchTerm1, "You have not supplied a valid search term in the first search field.", null));
ValidatorEntryOr veo = new ValidatorEntryOr("If you have entered a term in the second search term field, please select a condition. If you have selected a condition but not entered a second search term, please enter the second search term.");
ValidatorEntryAnd vea1 = new ValidatorEntryAnd();
ValidatorEntryAnd vea2 = new ValidatorEntryAnd();
vea1.Add(new ValidatorEntryRequired(SearchTerm2, null, null, true));
vea1.Add(new ValidatorEntryRequired(Condition, null, null, true));
vea2.Add(new ValidatorEntryRequired(SearchTerm2, null, null, false));
vea2.Add(new ValidatorEntryRequired(Condition, null, null, false));
veo.Add(vea1);
veo.Add(vea2);
v.Add(veo);
}
void Submit_Clicked(object o, EventArgs ea)
{
if (Page.IsValid)
{
// Do your thang here!
SuccessMessage.Text = "Crikey! You just ran a search!";
}
}
</script>
The "AND" portion of the example above is more or less equivalent to the following condition (in Javascript): var isValid = (SearchTerm2.value == "" && Condition.value == "") || (SearchTerm2.value != "" && Condition.value != "")
Constructors
ConstructorsValidatorEntryAndpublic ValidatorEntryAnd()
Creates a ValidatorEntryAnd with no message. ValidatorEntryAndpublic ValidatorEntryAnd(string sMessage)
Creates a ValidatorEntryAnd with a message. ValidatorEntryAndpublic ValidatorEntryAnd(string sMessage, string sHighlightElement)
Creates a ValidatorEntryAnd with a message and a client-side highlight element signature. © 2002 - 2009 Copyright, Disclaimer and Privacy Statement |
||||||