thanks!I am not sure what do you mean by "validator will check the data and decide which step is the next step." Can you post your code?
To cancel the nextbutton event you can do something like
protectedvoid Wizard1_NextButtonClick(object sender,WizardNavigationEventArgs e){
if(Wizard1.WizardSteps[e.CurrentStepIndex].StepType ==WizardStepType.Finish)
e.Cancel =true;
}
Thanks for reply.
On my first step page, there is a TextBox, user will type in their areacode, so I put a validator there to make sure user type in an areacode, and check if the areacode is valid, if it is valid, it will control which step is the next according the areacode. It looks like if I should put the code to decide which step to go into the NextButtonClick handler, but the validator event raises before the NextButtonClick event.
I saw that NextButtonClick event gets fired and saw the exception.
Canceling inside the event handler would not work in this scenario. So to avoid the firing of next button event completely wizardStep need to be templated. So you can get more control over the behavior of nextButton in the start step. Here is one example where next button click event doesnt get fired as the nextButton the the StartNavigationTemplate doesnt have the Command defined. I think that will server your purpose.
<asp:WizardID="Wizard1"runat="server">
<WizardSteps>
<asp:WizardSteprunat="server"Title="Step 1">
<asp:TextBoxID="TextBox1"runat="server"></asp:TextBox>
<asp:CustomValidatorID="CustomValidator1"runat="server"ErrorMessage="CustomValidator"OnServerValidate="CustomValidator1_ServerValidate"></asp:CustomValidator>
</asp:WizardStep>
<asp:WizardSteprunat="server"Title="Step 2">
</asp:WizardStep>
<asp:WizardStepID="Step3"runat="server">
</asp:WizardStep>
</WizardSteps>
<StartNavigationTemplate>
<asp:ButtonID="StartNextButton"runat="server"Text="Next"/>
</StartNavigationTemplate>
</asp:Wizard>
HTH,
Vishal
0 comments:
Post a Comment