I am using asp.net wizard in my project which is new to me. I have validations in one of the steps in my wizard. If the validation fails i should not allow the user to go to next step. And i am using a asp.net button which navigate between the steps in wizard. I would really appreciate if anyone could help me.
You could try canceling the Wizard's SideBarButtonClick and NextButtonClick events:
protected void Wizard1_SideBarButtonClick(object sender, WizardNavigationEventArgs e)
{
e.Cancel = !ValidateWizardStep(e.NextStepIndex);
}
protected void Wizard1_NextButtonClick(object sender, WizardNavigationEventArgs e)
{
e.Cancel = !ValidateWizardStep(e.NextStepIndex);
}
I tweaked the code a little bit sent by Ulises and made it work.
I have added onNextButtonClick
property for wizard
<asp:Wizard ID="wizClaimInfo" runat="server" CssClass="wizard" DisplayCancelButton="True" ActiveStepIndex="0" OnNextButtonClick="wizClaimInfo_NextButtonClick">
In the codebehind added following event
protected void wizClaimInfo_NextButtonClick(object sender, WizardNavigationEventArgs e) {
if (!IsValid)
{
e.Cancel = true;
}
return;
}
and also followed instruction given in below link.
http://forums.asp.net/t/1014412.aspx/2/10
I hope this will help someone in the future, because i spent almost 2 days trying to figure it out. And special thanks to Mr.Ulises.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With