1. We often have the following situations:
That is, the user must enter a new one due to an incorrect information during registration. However, this process goes through the server PostBack. So the Password box is cleared. In PostBack mode, if the textmode of textbox is password, the value attribute is not passed, so the Password box is empty. In fact, this problem can be solved.
2 .:
Generally, the password cannot be saved:
After processing, you can save the password
Code:
Background code
Using system;
Using system. Data;
Using system. configuration;
Using system. Web;
Using system. Web. Security;
Using system. Web. UI;
Using system. Web. UI. webcontrols;
Using system. Web. UI. webcontrols. webparts;
Using system. Web. UI. htmlcontrols;
Using system. runtime. remoting;
Using system. runtime. remoting. lifetime;
Using system. IO;
Public partial class _ default: system. Web. UI. Page
{
Protected void page_load (Object sender, eventargs E)
{
This. Password. Attributes. Add ("value", request ["password"]); // events added to the password box
}
Protected void button#click (Object sender, eventargs E)
{
}
}
Front-end code
<% @ Page Language = "C #" autoeventwireup = "true" codefile = "default. aspx. cs" inherits = "_ default" %>
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head runat = "server">
<Title> tips for saving the Password box http://blog.csdn.net/21aspnet/ clear moon </title>
</Head>
<Body>
<Form ID = "form1" runat = "server">
<Div>
<Asp: Label id = "label1" runat = "server" text = "enter the password"> </ASP: Label>
& Nbsp; <asp: textbox id = "password" runat = "server" textmode = "password"> </ASP: textbox>
<Asp: button id = "button1" runat = "server" text = "Submit" onclick = "button#click"/> </div>
</Form>
</Body>
</Html>