<  asp:TextBox  id="TextBox1"  runat="server"  value="<%#passwd%>" TextMode="Password" > cs文件里
protected System.Web.UI.WebControls.TextBox TextBox1;
后加上
public string passwd;最后在Click事件里写上
passwd=TextBox1.Text;
TextBox2.DataBind();

解决方案 »

  1.   

    最后应为TextBox1.DataBind();
      

  2.   

    哥们,我试了,没用啊。
    我还用了另外的方法,自己响应OnTextChanged 消息,
    试图先将passwd保存在另一个label中,如果用户没有修改
    passwd,在page_load中将passwd的值再赋回来,可是
    当我修改pass时,系统并没有调用OnTextChanged。甚至我将pass保存在数据库中,在显示的时候读出来,
    赋给passwd.text,但还是不显示星号。并且一点提交,
    读出的passwd还是空。
      

  3.   

    Dim myOldPass As String ="123456";
    DataBind() '要进行数据邦定 <asp:TextBox id="txtPass" size="20" TextMode="password" value="<%# myOldPass %>" runat=server />保证好用,别忘给分的诺言呀
    </body>
    </html> 
    Top 
     
      

  4.   

    怎么会不行呢?你用的正式版?
    试试这个
    vs.net beta2
    WebApplication3
    WebForm4.aspx<%@ Page language="c#" Codebehind="WebForm4.aspx.cs" AutoEventWireup="false" Inherits="WebApplication3.WebForm4" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <HTML>
    <HEAD>
    <meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
    <meta content="C#" name="CODE_LANGUAGE">
    <meta content="JavaScript (ECMAScript)" name="vs_defaultClientScript">
    <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    </HEAD>
    <body MS_POSITIONING="GridLayout">
    <form id="WebForm4" method="post" runat="server">
    <FONT face="宋体">
    <asp:textbox id="TextBox1" style="Z-INDEX: 101; LEFT: 48px; POSITION: absolute; TOP: 38px" runat="server" Width="78px" Height="26px" value="<%#passwd%>" TextMode="Password"></asp:textbox>
    <asp:button id="Button1" style="Z-INDEX: 102; LEFT: 157px; POSITION: absolute; TOP: 42px" runat="server" Width="55px" Height="27px" Text="Button"></asp:button>
    </FONT>
    </form>
    </body>
    </HTML>WebForm4.aspx.csusing System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;namespace WebApplication3
    {
    /// <summary>
    /// Summary description for WebForm4.
    /// </summary>
    public class WebForm4 : System.Web.UI.Page
    {
    protected System.Web.UI.WebControls.TextBox TextBox1;
    protected System.Web.UI.WebControls.Button Button1;
    public string passwd;
    public WebForm4()
    {
    Page.Init += new System.EventHandler(Page_Init);
    } private void Page_Load(object sender, System.EventArgs e)
    {
    // Put user code to initialize the page here
    } private void Page_Init(object sender, EventArgs e)
    {
    //
    // CODEGEN: This call is required by the ASP.NET Web Form Designer.
    //
    InitializeComponent();
    } #region Web Form Designer generated code
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {    
    this.Button1.Click += new System.EventHandler(this.Button1_Click);
    this.Load += new System.EventHandler(this.Page_Load); }
    #endregion private void Button1_Click(object sender, System.EventArgs e)
    {
    passwd=TextBox1.Text;
    TextBox1.DataBind();
    Response.Write(TextBox1.Text); }
    }
    }