Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     




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.

Share this article   |    Print    |    Article read by 1707 times
Author:
Rohit kakria
I am software developer, moderator of xpode.com
Related Articles: No related article
Related Interview Questions: