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