In Asp.net the password textbox will not remain the value after postback so for that we can use this steps
to maintain the values.
The Coding As follows.
In the design page
<asp:textbox onprerender="txtPassword_PreRender" id="txtPassword" text="abcd" maxlength="25" cssclass="TextBox" width="150px" runat="server" textmode="Password"></asp:textbox>
<asp:button onclick="btnSubmit_Click" id="btnSubmit" runat="server" text="Submit"/>
In the Code behind page
protected void txtPassword_PreRender(object sender, EventArgs e)
{
txtPassword.Attributes["value"] = txtPassword.Text;
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
}
Have a look at below images,
to maintain the values.
The Coding As follows.
In the design page
<asp:textbox onprerender="txtPassword_PreRender" id="txtPassword" text="abcd" maxlength="25" cssclass="TextBox" width="150px" runat="server" textmode="Password"></asp:textbox>
<asp:button onclick="btnSubmit_Click" id="btnSubmit" runat="server" text="Submit"/>
In the Code behind page
protected void txtPassword_PreRender(object sender, EventArgs e)
{
txtPassword.Attributes["value"] = txtPassword.Text;
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
}
Have a look at below images,
No comments:
Post a Comment