[英]OnClick event not working for linkbutton in a master page
这是html,
<asp:LinkButton ID="hlnkLogoffF" runat="server" Text="Logoff" OnClick="hlnkLogoffF_Click" ></asp:LinkButton>
这是背后的代码,
protected void hlnkLogoffF_Click(Object sender, EventArgs e)
{
//do something here
}
运行此命令时,出现以下错误,
“没有找到您要查的资源。 ”
你必须用
if (!Page.IsPostBack)
{
// Your code here
}
在母版页后面的代码中。
也
如果您关闭了CausesValidation设置为false的验证,会发生什么?
我试图运行您的代码
.aspx
<asp:LinkButton ID="hlnkLogoffF" runat="server" Text="Logoff" OnClick="hlnkLogoffF_Click" ></asp:LinkButton>
.Cs
protected void hlnkLogoffF_Click(object sender, EventArgs e)
{
}
我没有收到任何错误。能否将代码发布在click事件中?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.