I'm trying to create a user login form in ASP.NET webforms using web controls. I get this error in the designer class when I compile the code. The code for the login form is as follows :
<form class="cd-form">
<p class="fieldset">
<label class="image-replace cd-email" for="signin-email">Username</label>
<asp:TextBox class="full-width has-padding has-border" ID="signin-email" type="email" placeholder="E-mail" runat="server"></asp:TextBox>
<span class="cd-error-message">Error message here!</span>
</p>
<p class="fieldset">
<label class="image-replace cd-password" for="signin-password">Password</label>
<asp:TextBox class="full-width has-padding has-border" ID="signin-password" type="text" placeholder="Password" runat="server"></asp:TextBox>
<a href="#0" class="hide-password">Hide</a>
<span class="cd-error-message">Error message here!</span>
</p>
<p class="fieldset">
<input type="checkbox" id="remember-me" checked>
<label for="remember-me">Remember me</label>
</p>
<p class="fieldset">
<asp:Button ID="btn_login" runat="server" value="Login" OnClick="btn_login_Click1" />
</p>
</form>
Why am I getting this error?
Edit:
Here's the designer code
public partial class main {
/// <summary>
/// signin-email control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox signin-email;
/// <summary>
/// signin-password control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox signin-password;
/// <summary>
/// btn_login control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btn_login;
}
Using dashes in variable names is not allowedin C#. You do so by specifying signin-email
as ID
for your asp:TextBox
for example. The auto-generated code will use these values in the C# code.
Rename the fields to use underscores, not dashes.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.