如何在文本框中显示一个值,其中textmode在c#中设置为'password'

时间:2022-07-09 00:58:18

The code given below is to check the username n display the password via cookie. It works perfectly allright. since i want the value displayed in the password.text to be masked, i changed the textmode of the password.text to 'password'. as a result value isnt passed to the textbox.

下面给出的代码是检查用户名n通过cookie显示密码。它完美无瑕。因为我希望屏蔽password.text中显示的值,所以我将password.text的textmode更改为'password'。因此,值不会传递到文本框。

how can i solve this issue?

我该如何解决这个问题?

       String cookiename = TextBox1.Text;

        //grab cookie
        HttpCookie cookie = Request.Cookies[cookiename];

        //exists?
        if (null == cookie)
        {
            Label1.Text = "cookie not found";
        }
        else 
        { 
            password.Text=cookie.Value.ToString();

        }

thank you,

1 个解决方案

#1


TextBox2.Attributes.Add("value", cookie.Value.ToString());

#1


TextBox2.Attributes.Add("value", cookie.Value.ToString());