![](/img/trans.png)
[英]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.