Does anybody show me an example of ext.net validation? I want to mix asp.net and ext.net validation. Or use ext.net validation only.
I've already saw these examples http://examples.ext.net/#/Form/Validation/Custom_VType/ and http://examples.ext.net/#/Form/FormPanel/Validation/ but it's not enough.
Also, I wonder why the code bottom doesn't work. It throws an exception
"Page.IsValid cannot be called before validation has taken place. It should be queried in the event handler for a control that has CausesValidation=True and initiated the postback, or after a call to Page.Validate"
<script runat="server">
void Button_Click(object sender, EventArgs e) {
// Display whether the page passed validation.
if (Page.IsValid) {
Label1.Text = "Page is valid.";
}
else {
Label1.Text = "Page is not valid!";
}
}
void ServerValidation(object source, ServerValidateEventArgs args) {
try {
// Test whether the value entered into the text box is even.
int i = int.Parse(args.Value);
args.IsValid = ((i % 2) == 0);
}
catch (Exception ex) {
args.IsValid = false;
}
}
</script>
<ext:Label ID="Label1" runat="server" Text="Enter an even number:" />
<br />
<ext:TextField ID="TextField1" runat="server" />
<asp:CustomValidator runat="server" ControlToValidate="TextField1" OnServerValidate="ServerValidation"
ErrorMessage="Not an even number!" />
<ext:Button runat="server" Text="Validate" >
<DirectEvents>
<Click OnEvent="Button_Click" />
</DirectEvents>
</ext:Button>