Xpode.com        Click here to Print this article.

Maintain an entered password in textbox after postback

Have you seen that when a post back occurs, the password field empty field empty its value. We may preserve the password field value with writing a little code in code behind in page load. Code is below.

Page_Load(object sender, System.EventArgs e)
{
  if (Page.IsPostBack)
   {
    TextBox1.Attributes.Add("value", TextBox1.Text);
   }
}

This code will preserve the value of password after postback.



http://
http://

Contributed by:
Rohit kakria
I am software developer, moderator of xpode.com

Resourse address on xpode.com
http://www.xpode.com/Print.aspx?Articleid=313

Click here to go on website