<script language="javascript">
function txtReplace()
{
  Form1.pwd.value="password";
}
</script>

解决方案 »

  1.   

    string password = "asdfasdf";
    this.textbox.Text = password;
      

  2.   

    不用javascript不行吗?我想通过按钮来给它赋值如何实现
      

  3.   

    to cyp403(翱翔) 
    textmode为password时TextBox 的所有字符均被屏蔽
      

  4.   

    是asp.net还是win应用呢win应用的话this.textbox.Text = password;不就得了?
    web的话因为页面load时会丢掉password,在page_load里加
    this.txtPassword.Attributes.Add("value", txtPassword.Text.Trim());