views:

100

answers:

3

Is there a way that i can save data on each step in wizard control. I want to save data when user clicks next button on each step. I would like to save them to database , so that i can retrieve them back if user has opted to close and complete steps later without clicking finish button

A: 

In ASP.NET you can probably stick it in the Session variable.

In an WPF or Winforms app, you could just put it in a variable in memory, and if these are settings for your program, you could save them to an XML file.

Tony
i would like to save each step, bcos user may close browser and complete them later
rs
+1  A: 

You can save data to Session or ViewState objects.

Also you can add you saving logic in wizard events: ActiveStepChanged, CancelButtonClick, FinishButtonClick, NextButtonClick, PreviousButtonClick, SideBarButtonClick.

sashaeve
+2  A: 

In your code-behind, you can capture the "Active Step Changed" event and do whatever you want:

Protected Sub AddEmployeeWizard_ActiveStepChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles AddEmployeeWizard.ActiveStepChanged

  'save your data here

End Sub

If you just want to save on a click of the Next button, you could instead do

Protected Sub myWizard_NextButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles myWizard.NextButtonClick

    'save your data here

End Su

b

JacobM
i would like 2 save data when clicked next button, this event will fire for both next, previous. Is there a way i can distinguish each ?
rs
Edited to add an example of saving on a Next click.
JacobM
yes that is correct answer, i tested it and it works perfectly, thank you
rs