Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validating wizard step and staying there if false

Status
Not open for further replies.

sodakotahusker

Programmer
Mar 15, 2001
601
I have to work on a project with a wizard and six steps. I've never used this control before. Unfortunately they've just asked me to add validation to one of the steps. I can capture the fact there is a problem and prevent it from moving to the next step -- but my user control disappears. I tried setting the ActiveStepIndex back one hoping it would just do the same step over (though that might cause the data that was input to be lost?). Anyway I'm dead in the water with this one without some help. Thanks!!!
 
can't do much without code. if you add any control at runtime they must be added on every postback in the Page.Init event.

by default the Next buttons cause validation. Previous shouldn't cause validation. also in the next event make sure you check the validation before processing.
Code:
protected void MyWizard_MoveNext(object sender, WizardNavigationEventArgs e)
{
  if (Page.IsValid)
  {
      MyWizard.ActiveStepIndex = e.NewIndex;
  }
}

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Thanks for the feedback. There is a cancel event on the event argument so e.cancel does the trick for me! This looks like some pretty slick stuff.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top