Reputation: 2415
Right now I have an asp:Wizard with 3 Steps.
When the finish button is clicked on the third step I would like to Create the user and send the form. I have the logic for this written but the only problem I have is the when the next button is pressed on a wizard, a PostBack occurs and my password field:
<asp:TextBox ID="txtPassword" TextMode="Password" Width="70%" runat="server" />
Does not retain its value.
What would you suggest would be the most secure and practical method for me to overcome this problem?
Upvotes: 4
Views: 6853
Reputation: 21
I don't think you need to create any classes; just use the following line of code in your page_load
method:
YourTextBoxName.Attributes["value"] = YourTextBoxName.Text ;
This should probably solve this problem.
Upvotes: 2
Reputation: 68506
I would probably develop a class representing the data that will be created by the wizard:
public class WizardForm
{
public User NewUser {get;set;}
public Form FormToEmail {get;set;}
}
Then on each step through the wizard I'd update this class and store it in session:
WizardForm form = Session["WizardForm"] as WizardForm;
if (form == null)
{
form = new WizardForm();
Session["WizardForm"] = form;
}
form.User.Password = txtPassword.Text; // etc
Or you could just store the password in Session and retrieve it later:
Session["WizardPassword"] = txtPassword.Text;
string password = Session["WizardPassword"].ToString();
Upvotes: 2
Reputation: 21881
This beavior is built in to the asp.net TextBox control when in Password mode. If you want different behavior you can either create your own password server control or use a normal HTML input control with runat="server". You could also just save the password when the user progresses to the next wizard step and then display a place holder instead of the text box. In order to change or edit thet password the user has to go back to the relevant wizard step.
Upvotes: 1