Adding default value to ASP TextBox with TextMode = Password
I've found articles about this online, but I can't seem to get it to work.
Here is my current HTML (with all the jumbled layout stuff taken out)
<asp:Login ID="LoginUser" runat="server" EnableViewState="false"
OnAuthenticate="LoginUser_Authenticate">
<LayoutTemplate>
<asp:TextBox ID="UserName" runat="server" Text="username"
CssClass="text-box login-text-box"></asp:TextBox>
<asp:TextBox ID="Password" runat="server" CssClass="text-box
login-text-box" TextMode="Password"></asp:TextBox>
</LayoutTemplate>
</asp:Login>
Here is the server-side code I found online:
protected void Page_Load(object sender, EventArgs e)
{
txtPassword.Attributes.Add("value", "defaultpassword")
}
I keep getting the message: "txtPassword does not exist in the current
context".
I get that error for anything I change the, "txtPasssword", text to.
No comments:
Post a Comment