在之前的学习中,对于Html中的标签中的onClick属性,都是调用的是js中的方法,相应的,在html标签中也是可以使用后台代码中的方法的。
Login.aspx: <asp:Button ID="Button1" runat="server" OnClick="LoginClick" class="btn btn-primary btn-flat" Text="登 陆" />
Login.aspx.cs
protected void LoginClick(object sender, EventArgs e)
{
this.Session["canview"] = null;
this.Session.Abandon();
}