让textbox实现记忆功能,是将输入的内容写到数据库中或文本文件中,下次载入里读取数据库最新的几条记录

解决方案 »

  1.   

    autocomplete实现不了。必须存储在文本文件(包括配置文件)、注册表或者数据库中。
      

  2.   

    Cookie实现密码记忆功能
      protected void Button1_Click(object sender, EventArgs e)
        {
            if (txtname.Text.Trim().Equals("mr") && txtpwd.Text.Trim().Equals("mrsoft"))
            {
                Session["username"] = txtname.Text.Trim();
                if (ckbauto.Checked)
                {
                    if (Request.Cookies["username"] == null)
                    {
                        Response.Cookies["username"].Expires = DateTime.Now.AddDays(30);
                        Response.Cookies["userpwd"].Expires = DateTime.Now.AddDays(30);
                        Response.Cookies["username"].Value = txtname.Text.Trim();
                        Response.Cookies["userpwd"].Value = txtpwd.Text.Trim();
                    }
                }
                Response.Redirect("admin.aspx");
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(),"","alert('用户名或密码错误!');",true);
            }
        }
        protected void txtname_TextChanged(object sender, EventArgs e)
        {
            if (Request.Cookies["username"] != null)
            {//CodeGo.net/
                if (Request.Cookies["username"].Value.Equals(txtname.Text.Trim()))
                {
                    txtpwd.Attributes["value"] = Request.Cookies["userpwd"].Value;
                }
            }
        }
      

  3.   

    通常把用户名,密码加密一下,保存在ini配置文件,打开登录界面时,再读取ini文件
      

  4.   

    放在配置文件(ini或者xml)中,下次使用直接用配置文件中读取