Tuesday, September 12, 2006

How to prevent user to proceed to next steps in wizard control asp.net 2.0

Dear All,
i have the case which is how to prevent the user to proceed to next steps in Next steps in wizard control in asp.net 2.0,take this business scenario :

suppose we have a dataentry form the user has to fill it efore going to the next step,and you have a validation on this form as well,you will see that if user click to the sidebar links,the validation will not fire.

Solution :
try to cancel going to the next step by cancel the event handler.

code :

if (e.NextStepIndex > e.CurrentStepIndex)
{
Page.Validate("GroupName");
if (!Page.IsValid)
{
e.Cancel = true;
}
}

just validate the page against the validation group (if you want),and if the pae is not validated cancel movenext event,this code will remain the control to the current step.

Happy programming..................:)

Regards,
Moustafa arafa

1 comment:

Anonymous said...

That is exactly what I needed. Thank you!