[英]invalid token ';' in class struct or interface member declaration
[英]Invalid token ';' in class, struct, or interface member declaration
我正在尝试使用Web控件在ASP.NET Web表单中创建用户登录表单。 编译代码时,在设计器类中收到此错误。 登录表单的代码如下:
<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>
为什么会出现此错误?
编辑:
这是设计师代码
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;
}
C#中不允许在变量名称中使用破折号。 为此,您可以指定signin-email
作为asp:TextBox
ID
。 自动生成的代码将在C#代码中使用这些值。
重命名字段以使用下划线,而不是破折号。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.