我有一個導航下拉列表中的ASP鏈接按鈕。它將用於註銷,所以我有一個事件鏈接到後面的代碼,我將關閉並清空會話。但是,當我啓動我的項目,它給這個錯誤:ASP.net Linkbutton與代碼隱藏onclick事件不起作用
CS1061: 'ASP.main_aspx' does not contain a definition for 'LinkButton_Click' and no extension method 'LinkButton_Click' accepting a first argument of type 'ASP.main_aspx' could be found (are you missing a using directive or an assembly reference?)
這是我的aspx代碼
<li><asp:LinkButton id="myLink" Text="Logout" OnClick="LinkButton_Click" runat="server"/></li>
,這是後臺代碼的代碼
void LinkButton_Click(Object sender, EventArgs e)
{
Session.Clear();
Session.RemoveAll();
Session.Abandon();
Response.Redirect("Login.aspx");
}
謝謝,我錯過了 – TENNO