当前位置: 代码迷 >> ASP.NET >> |M| 怎么对Passwod模式的TextBox进行赋值
  详细解决方案

|M| 怎么对Passwod模式的TextBox进行赋值

热度:4186   发布时间:2013-02-25 00:00:00.0
|M| 如何对Passwod模式的TextBox进行赋值
我在程序中写txtPass= "123456 "
但在页面中却是为空的
怎么办

------解决方案--------------------------------------------------------
try:
txtPass.Attributes.Add( "value ", "123456 ");
------解决方案--------------------------------------------------------
是啊,很简单的,100分就这么没了
------解决方案--------------------------------------------------------
楼上正解
------解决方案--------------------------------------------------------
最好是这样 if (this.IsPostBack {if( this.txtPass.Text.Trim()!= "****** "){ this.Password = this.txtPass.Text.Trim(); } txtPass.Attributes.Add( "value ", "******* "); } protected string Password { get { return ViewState[ "Password "] != null ? (string)ViewState[ "Password "] : " "; } set { ViewState[ "Password "] = value; } }使用的时候用this.Password
------解决方案--------------------------------------------------------
灌水.
  相关解决方案