gridview中我绑定了密码
在编辑的状态下,我使用了密码文本框<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" TextMode="password" Value='<%# Eval("Password") %>' Text='<%# Bind("password")%>' BorderWidth="0"></asp:TextBox>
</EditItemTemplate>
我按钮编辑按钮,这个密码框为空了。
这样的话,每次都要重新输入可不可以在编辑状态密码框为原来的密码,显示“******”

解决方案 »

  1.   

    编辑的时候要修改原来的密码么?
    如果不保存密码,直接在编辑按钮事件中设置xxx.Text = "*******";如果保存修改后的密码,在编辑按钮事件中设置xxx.Text = "*******";可以将原密码将存起来,比如存在这个事件处理的一个变量中,然后根据xxx.Text的内容来决定在保存修改时用什么?如果xxx.Text为******,则用原密码;否则用xxx.Text内容
      

  2.   

    password文本框赋值使用
    Txtpassword.Attributes.Add("value","");
      

  3.   

    好像没有什么事件可以保存原来的密码啊Txtpassword.Attributes.Add("value","");
    要写在哪里?
      

  4.   

    可以在GridView1_RowDataBound事件直接为密码框赋值
    加上两个判断
    if(e.Row.RowType == DataControlRowType.DataRow) {
                    if(e.Row.RowIndex == GridView1.EditIndex){...}}
      

  5.   

    在RowDataBound中判断修改时绑定数据到textbox
      

  6.   

     if (e.Row.RowState == DataControlRowState.Edit || ((int)(e.Row.RowState & DataControlRowState.Edit)) != 0)
    {
    TextBox  txt= e.Row.FindControl("TextBox1") as TextBox  ;
    }