H
hardieca
Hi!
I have a CreateUserWizard control with the usual suspects of
validators. As you're probably aware, each validator is associated
with one of CreateUserWizard's child controls.
When a user clicks on the Create User button on the first page,
validation occurs with javascript turning on a ValidationSummary, so
no postback occurs. For accessibility reasons, I would like the page
to be posted back so screen readers would be able to find the
validation errors.
Furthermore, if I could get a postback, I could also check the
ValidatorCollection for validators with their IsValid property set to
"false" in the page's PreRender event. I would like to cast the
validator back into it's original type (somehow?), find the value of
its AssociatedControlID, and then apply a class to its associated
control in the CreateUserWizard form.
Hopefully I could dynamically generate a class for each control that I
could style with CSS to draw attention to the fact that it contains
invalid data. I'd like to have a class applied to the rendered HTML
like:
<input type="text" class="alert" ...
Then with a trivial style in the CSS (e.g. input.alert { border:1px
solid red; } ) I could increase the usability of the form. It's a
mechanism I would like to extend to all forms in my site once I get it
working.
But my problem is when I use the CreateUserWizard, the page never gets
posted back if validation errors have occurred, so I can't trap for
the page's PreRender event AFTER the validation errors have happened.
Is there a way I can ensure the page will get posted back when someone
clicks the "Create User" button?
Also, if someone knows how I could cast an object that implements
IValidator back into its original type so I can access its
AssociatedControlID property without knowing the original type before
run-time, I'd love to hear about that too!
Let me know if I haven't been clear.
Cheers,
C.
I have a CreateUserWizard control with the usual suspects of
validators. As you're probably aware, each validator is associated
with one of CreateUserWizard's child controls.
When a user clicks on the Create User button on the first page,
validation occurs with javascript turning on a ValidationSummary, so
no postback occurs. For accessibility reasons, I would like the page
to be posted back so screen readers would be able to find the
validation errors.
Furthermore, if I could get a postback, I could also check the
ValidatorCollection for validators with their IsValid property set to
"false" in the page's PreRender event. I would like to cast the
validator back into it's original type (somehow?), find the value of
its AssociatedControlID, and then apply a class to its associated
control in the CreateUserWizard form.
Hopefully I could dynamically generate a class for each control that I
could style with CSS to draw attention to the fact that it contains
invalid data. I'd like to have a class applied to the rendered HTML
like:
<input type="text" class="alert" ...
Then with a trivial style in the CSS (e.g. input.alert { border:1px
solid red; } ) I could increase the usability of the form. It's a
mechanism I would like to extend to all forms in my site once I get it
working.
But my problem is when I use the CreateUserWizard, the page never gets
posted back if validation errors have occurred, so I can't trap for
the page's PreRender event AFTER the validation errors have happened.
Is there a way I can ensure the page will get posted back when someone
clicks the "Create User" button?
Also, if someone knows how I could cast an object that implements
IValidator back into its original type so I can access its
AssociatedControlID property without knowing the original type before
run-time, I'd love to hear about that too!
Let me know if I haven't been clear.
Cheers,
C.