For web application use code given below
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
TextBox1.TextMode = (CheckBox1.Checked ? TextBoxMode.SingleLine : TextBoxMode.Password);
}
For windows application use code given below
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
textBox1.PasswordChar = (checkBox1.Checked ? char.MinValue : '*');
}