I have a boolean named CheckBoxActivated, which I set to true after checking the username and password.
string name = us.UserName;
string password = us.Password;
if (name.Equals(txtName.Text) && (password.Equals(txtPassword.Text)))
{
CheckBoxAvtivated = true;
The strange thing is: after I return to the variable, I press another button and immediately becomes “false”, which leads to undesirable behavior.
protected void butNext_Click(object sender, EventArgs e)
{
if (CheckBoxAvtivated)
{
pnlCheckBoxes.Visible = true;
pnlUserCheckBoxValidation.Visible = false;
}
else
{
pnlCheckBoxes.Visible = false;
pnlUserCheckBoxValidation.Visible = true;
}
Thus, the state of the variable unexpectedly changes to false. Any reason why this could happen?
source
share