asp.NET LinkButton 在 Google Chrome 中不起作用
我有一个包含多个链接按钮的页面,但所有这些按钮都无法在 Google Chrome 中工作。 它们在 IE 和 Firefox 中运行良好。 Chrome Inspector 可以找到链接按钮,并且它附加了一个用于回发调用的 javascript-postback。 该按钮放置在多个面板内,但这不应该是问题,或者?
<asp:Panel runat="server" ID="pnlLike">
<div class="singleRecept_Toolbar_Item">
<asp:LinkButton ID="lnkBtnVote" runat="server" OnClick="VoteRecept">I like </asp:LinkButton>
<asp:Image ID="imgVote" ImageUrl="/images/LCHF/likeIcon.gif" runat="server" Visible="true" />
</div>
</asp:Panel>
I have a page with several linkbuttons, and all of them is not working in Google Chrome. They are working well in IE and Firefox. Chrome Inspector can find the linkbutton and it has a javascript-postback attached for a postback call. The button is placed inside several panels, but that should not be the problem, or?
<asp:Panel runat="server" ID="pnlLike">
<div class="singleRecept_Toolbar_Item">
<asp:LinkButton ID="lnkBtnVote" runat="server" OnClick="VoteRecept">I like </asp:LinkButton>
<asp:Image ID="imgVote" ImageUrl="/images/LCHF/likeIcon.gif" runat="server" Visible="true" />
</div>
</asp:Panel>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
将以下代码添加到基页的
OnPreInit
方法中。Add the following code to
OnPreInit
method of base page.您可以尝试在 Chrome 中打开 JavaScript 控制台(Ctrl+Shift+j),看看加载页面或单击按钮时是否报告任何错误。
我遇到过由完全不相关的 JavaScript 错误引起的 LinkButtons 问题。
You could try to open the JavaScript console in Chrome (Ctrl+Shift+j) and see if any errors are reported when loading the page or when clicking the buttons.
I've experienced problems with LinkButtons caused by totally unrelated JavaScript errors.
如果这适用于其他浏览器而不是 Chrome,那么您应该在此处。
If this works in other browsers and not chrome, then you should file a bug here.
禁用“Chrome 工具箱(由 Google)”扩展解决了我的问题。 如果您没有该扩展程序,请仍然尝试禁用所有 Chrome 扩展程序。
当我遇到这个问题时,我的第一直觉是它与 ASP 提供的 Javascript 不兼容,但后来我注意到 Stackoverflow 上的某些链接也存在同样的问题。
另外值得注意的是,只有左键单击被破坏 - 中键单击链接仍然在新选项卡中打开它们。
Disabling the "Chrome Toolbox (by Google)" extension fixed the issue for me. If you don't have that extension still try disabling all your Chrome extensions.
When I had the issue, my first instinct was that it was incompatible Javascript provided by ASP but then I noticed the same exact issue on certain links here at Stackoverflow.
Also worth noting is that only the left click was broken - middle clicking links still opened them in a new tab.