In previous posts I explained many articles relating to Asp.net, JQuery, and SQL etc. Now I will explain how to maintain text of password textbox during postbacks in asp.net. Generally if you observer password textbox it won’t maintain text if any postback happens like as shown below
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Maintain Password textbox data in postback</title>
</head>
<body>
<form id="form1"
runat="server">
<div>
<table>
<tr>
<td><b>UserName:</b></td>
<td><asp:TextBox ID="txtUserName"
runat="server"/></td>
</tr>
<tr>
<td><b>Password</b></td>
<td><asp:TextBox ID="txtPwd"
runat="server"
TextMode="Password"/></td>
</tr>
<tr>
<td></td>
<td><asp:Button ID="btnSubmit"
runat="server"
Text="Submit"
/></td>
</tr>
</table>
</div>
</form>
</body>
</html>
|
protected void Page_Load(object sender, EventArgs
e)
{
string pwd = txtPwd.Text;
txtPwd.Attributes.Add("value",
pwd);
}
|
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim pwd As String = txtPwd.Text
txtPwd.Attributes.Add("value",
pwd)
End Sub
|
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
Subscribe by RSS
Subscribe by Email
|
|||
|
|
|


Subscribe by RSS
Subscribe by Email
0 comments :