How do I make a Wizard control save the data after each step?
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 u开发者_JAVA技巧ser has opted to close and complete steps later without clicking finish button
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
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.
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.
精彩评论