gridview中我绑定了密码
在编辑的状态下,我使用了密码文本框<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" TextMode="password" Value='<%# Eval("Password") %>' Text='<%# Bind("password")%>' BorderWidth="0"></asp:TextBox>
</EditItemTemplate>
我按钮编辑按钮,这个密码框为空了。
这样的话,每次都要重新输入可不可以在编辑状态密码框为原来的密码,显示“******”
在编辑的状态下,我使用了密码文本框<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" TextMode="password" Value='<%# Eval("Password") %>' Text='<%# Bind("password")%>' BorderWidth="0"></asp:TextBox>
</EditItemTemplate>
我按钮编辑按钮,这个密码框为空了。
这样的话,每次都要重新输入可不可以在编辑状态密码框为原来的密码,显示“******”
如果不保存密码,直接在编辑按钮事件中设置xxx.Text = "*******";如果保存修改后的密码,在编辑按钮事件中设置xxx.Text = "*******";可以将原密码将存起来,比如存在这个事件处理的一个变量中,然后根据xxx.Text的内容来决定在保存修改时用什么?如果xxx.Text为******,则用原密码;否则用xxx.Text内容
Txtpassword.Attributes.Add("value","");
要写在哪里?
加上两个判断
if(e.Row.RowType == DataControlRowType.DataRow) {
if(e.Row.RowIndex == GridView1.EditIndex){...}}
{
TextBox txt= e.Row.FindControl("TextBox1") as TextBox ;
}