Text are wiped out in the textboxs

Hello, I have an application for resetting the passowrd. So far so good. There is a check box
<asp:CheckBox ID="chkForceChange" AutoPostBack="true" Checked="True" 
            runat="server"/>Force user to change password at next login:

Open in new window

If I topple it, the text in the text boxs are always wiped out.
My code:
public partial class ResetPassword : System.Web.UI.Page
        string userName = "";
        protected void Page_Load(object sender, EventArgs e)
            if (!User.IsInRole("Admin"))
                //If not an admin, send the user to the login page.
            // retrieve the username from the querystring
            userName = this.Request.QueryString["UserName"];

            if (!this.IsPostBack)
                MembershipUser user = Membership.GetUser(userName);
                lblUserName.Text = AntiXss.HtmlEncode(user.UserName);
                lblEmail.Text = AntiXss.HtmlEncode(user.Email);
                lblEmail.NavigateUrl = "mailto:" + AntiXss.UrlEncode(user.Email);
                lblRegistered.Text = AntiXss.HtmlEncode(user.CreationDate.ToString("f"));
                lblLastLogin.Text = AntiXss.HtmlEncode(user.LastLoginDate.ToString("f"));
                lblLastActivity.Text = AntiXss.HtmlEncode(user.LastActivityDate.ToString("f"));
                chkIsOnlineNow.Checked = user.IsOnline;
                SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MembershipDB"].ConnectionString);
                SqlCommand cmd = new SqlCommand();
                cmd.Connection = con;
                cmd.CommandText = "SELECT [last4SSN]  FROM [User_ExtraInfo] WHERE [UserID] = @UserID";
                string UserID = user.ProviderUserKey.ToString();
                cmd.Parameters.Add("@UserID", SqlDbType.VarChar).Value = UserID;
                DataTable dt = new DataTable();

                using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                lblSSN.Text = dt.Rows[0]["last4SSN"].ToString();

        protected void btnResetPw_Click(object sender, EventArgs e)
            string userName = this.Request.QueryString["UserName"];
            MembershipUser user = Membership.Providers["SqlMembershipProviderOther"].GetUser(userName,false);

            if (newPass.Text == confirmPass.Text && confirmPass.Text != null && confirmPass.Text.Length > 0)

Open in new window

The two text box's name are newPass and confirmPass.
Please look at the picture:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Set AutoPostBack="false" or remove the property if you don't need it explicitely.
Jesus RodriguezIT ManagerCommented:
Are you using AJAX or update panels for this?? The event for the Checkbox on checked Change will submit  a postback to the page and wipe out the text from the textbox
zhshqzycAuthor Commented:
If I remove the postback, can it guarantee the function of changing password at next login?
The AutoPostBack property defines whether you want to post the value instantly if it is changed, which means whenever you check or uncheck your checkbox it will be posted to the server if the property is set "true".
I asume you're posting and saving the values of all of your controls (including the value of your checkbox) if you hit the "Reset Password" button and it's therefore not necessary to post the checkbox value on every change.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.