asp.NET LinkBut​​ton的不是谷歌浏览器工作 [英] asp.NET LinkButton not working in Google Chrome

查看:315
本文介绍了asp.NET LinkBut​​ton的不是谷歌浏览器工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个页面有几个linkbuttons,和他们都没有在谷歌浏览器的工作。他们在IE和Firefox运作良好。 Chrome检查可以发现LinkBut​​ton的,它有附加的回发调用JavaScript回发。按钮被置于其内的几个板,但不应该是问题,或?

 < ASP:面板=服务器ID =pnlLike>
  < D​​IV CLASS =singleRecept_Toolbar_Item>
    < ASP:LinkBut​​ton的ID =lnkBtnVote=服务器的OnClick =VoteRecept>我喜欢< / ASP:LinkBut​​ton的>
    < ASP:图片ID =imgVote的ImageUrl =/图像/ LCHF / likeIcon.gif=服务器可见=真/>
  < / DIV>
< / ASP:面板>


解决方案

以下code加入在preINIT 基本页面的方法。

 保护覆盖无效在preINIT(EventArgs的发送)
{
    如果(Request.UserAgent = NULL&放大器;!及(Request.UserAgent.IndexOf(为AppleWebKit)0))//添加了镀铬的兼容性问题
    {
        this.ClientTarget =uplevel;
    }    base.On preINIT(E);
}

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>

解决方案

Add the following code to OnPreInit method of base page.

protected override void OnPreInit(EventArgs e)
{
    if (Request.UserAgent != null && (Request.UserAgent.IndexOf("AppleWebKit") > 0))  // added for compatibility issues with chrome 
    {
        this.ClientTarget = "uplevel";
    }

    base.OnPreInit(e);
}

这篇关于asp.NET LinkBut​​ton的不是谷歌浏览器工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆