Textbox losing value after postback
<p>My page is a registration page, where a user enters an e-mail address and password. Here is my click event:</p>

<pre><code>protected void btnRegister_Click(object sender, EventArgs e)
{
    MembershipCreateStatus createStatus = MembershipCreateStatus.ProviderError;

    MembershipUser user = Membership.CreateUser(txtUsername.Text,
        txtPassword.Text, txtEmail.Text, null, null, true, out createStatus);

    if (createStatus != MembershipCreateStatus.Success)
    {
        cvUser.IsValid = false;
        cvUser.ErrorMessage = "Invalid";
    }
    else
        Response.Redirect("Home");
}
</code></pre>

<p>Here is my page:</p>

<pre><code>&lt;asp:ValidationSummary ID="vs" runat="server" /&gt;

&lt;asp:TextBox ID="txtUsername" runat="server" /&gt;
&lt;asp:TextBox ID="txtEmail" runat="server" /&gt;
&lt;asp:TextBox ID="txtPassword" runat="server" TextMode="Password" /&gt;

&lt;asp:Button ID="btnRegister" runat="server" OnClick="btnRegister_Click" /&gt;
&lt;asp:CustomValidator ID="cvUser" runat="server" ControlToValidate="txtEmail" /&gt;
</code></pre>

<p><code>cvUser</code> is a custom validator on my page that I'm using so that the error message will show up on my <code>ValidationSummary</code>.</p>

<p>So the problem occurs when the user creation fails. I set <code>cvUser.IsValid</code> to false so that the error will show, and then the page reloads. Only when the page reloads, all the data in my textboxes is gone.</p>

<p>Is there a way to maintain that data?</p>
