M
Mathieu Pagé
Hi,
I'm using the Wizard control of ASP.NET 2.0 for the first time and I
have some problem to figure how to validate build a strong validation
mechanism around it.
My wizard have three steps, step 1 and two require some validation. I
placed some validation controls on each of theses steps and set their
"ValidationGroup" properties so that I can validate each steps separately.
When the user click the "Next" button, I do something like this :
<code>
' This validate the current step
Page.Validate("group" & myWizard.ActiveStepIndex)
If Page.IsValid() Then
myWizard.ActiveStepIndex += 1
End If
</code>
This work well. It first validate the current step and if it is valid,
it move to the next step.
However, when the user use the sidebar buttons it's more problematic. I
still can validate the current step in the SideBarButtonClick event, but
I can't validate the others steps.
Say the user is at step one and click on the sidebar button that should
get it to step 3. Before allowing that I must make sure that step 1 and
step 2 are valid. For step one it's easy, it's the current visible step
and the validation works normally. However if I try to validate the step
2 (Page.Validate("group1")) the page is still valid even if it should
not. I suspect that invisibles validator are not triggered.
How can I validate cross steps controls with the asp.net validators? Is
there a good doc somewhere on how to validate data within a Wizard? I
searched quite a bit and found nothing.
Mathieu Pagé
(e-mail address removed)
I'm using the Wizard control of ASP.NET 2.0 for the first time and I
have some problem to figure how to validate build a strong validation
mechanism around it.
My wizard have three steps, step 1 and two require some validation. I
placed some validation controls on each of theses steps and set their
"ValidationGroup" properties so that I can validate each steps separately.
When the user click the "Next" button, I do something like this :
<code>
' This validate the current step
Page.Validate("group" & myWizard.ActiveStepIndex)
If Page.IsValid() Then
myWizard.ActiveStepIndex += 1
End If
</code>
This work well. It first validate the current step and if it is valid,
it move to the next step.
However, when the user use the sidebar buttons it's more problematic. I
still can validate the current step in the SideBarButtonClick event, but
I can't validate the others steps.
Say the user is at step one and click on the sidebar button that should
get it to step 3. Before allowing that I must make sure that step 1 and
step 2 are valid. For step one it's easy, it's the current visible step
and the validation works normally. However if I try to validate the step
2 (Page.Validate("group1")) the page is still valid even if it should
not. I suspect that invisibles validator are not triggered.
How can I validate cross steps controls with the asp.net validators? Is
there a good doc somewhere on how to validate data within a Wizard? I
searched quite a bit and found nothing.
Mathieu Pagé
(e-mail address removed)