日期:2014-05-18  浏览次数:20389 次

|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
------解决方案--------------------
灌水.