ie10与ASP.net的兼容性问题,LinkButton点击时,出现问题。


在写ASP页面的时候,用IE10打开页面之后,点击下一页,没有反应。用IE8,IE9点击下一页均没有问题。

我的页面上是用LinkButton自定义的翻页控件。ASP代码如下:

 <PagerStyle ForeColor="Blue" BackColor="LightBlue"  HorizontalAlign="Center" />
               <PagerTemplate>
                <table width="100%">
                    <tr class="tdbg" align="center">
                       <td style="height: 39px; text-align: center"  class="paginator">
                            共<%=this.PageCount %>条数据      页码:
                            <asp:Label  ID="LabelCurrentPage" runat="server"
                                    Text="<%# ((GridView)Container.NamingContainer).PageIndex + 1 %>"></asp:Label>
                                /
                            <asp:Label ID="LabelPageCount" runat="server"
                            Text="<%# ((GridView)Container.NamingContainer).PageCount %>"></asp:Label> 页
                             每页15条
                            <asp:LinkButton ID="LinkButtonFirstPage" runat="server" CommandArgument="First" CommandName="Page"
                            Enabled='<%#((GridView)Container.NamingContainer).PageIndex != 0 %>'>首页</asp:LinkButton>
                            <asp:LinkButton ID="LinkButtonPreviousPage" runat="server" CommandArgument="Prev" CommandName="Page"
                             Enabled='<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>'>上一页</asp:LinkButton>
                             <asp:LinkButton ID="LinkButtonNextPage" runat="server" CommandArgument="Next" CommandName="Page"
                              Enabled='<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>'>下一页</asp:LinkButton>
                            <asp:LinkButton ID="LinkButtonLastPage" runat="server" CommandArgument="Last" CommandName="Page"
                             Enabled='<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>'>尾页</asp:LinkButton>
                              转到第
                            <asp:textbox id="txtNewPageIndex" runat="server" width="20px" text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>' />页
                            <asp:linkbutton id="btnGo" runat="server" causesvalidation="False" commandargument="-1"  commandname="Page" text="GO" />
                        </td>
                    </tr>
                </table>
             </PagerTemplate>

后来,将IE8,IE9,IE10的页面上的源代码,找出来对比。IE10中的源码中没有生成__doPostBack的javaScript的代码。导致不能回发,点击没有反应。而IE8,IE9中的源码中均有这段代码:

<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['aspnetForm'];
if (!theForm) {
    theForm = document.aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script>

后来看到了一篇论坛,遇到了和我一样的问题,他的解决方案是,将IE10浏览器,换成兼容模式,然后我就试了一下,换成兼容模式,源码中就生成了生成__doPostBack的javaScript的代码。


论坛地址:http://bbs.csdn.net/topics/390374229?page=1#post-393747839


参考地址:http://www.cnblogs.com/weapon/p/3150584.html

这篇文章的解决方案是将网址在“工具”中,将网站添加到兼容模式。


也有补丁可以从根本上解决这个问题:http://www.techweb.com.cn/news/2011-09-07/1090483.shtml


参考文章:http://blogs.msdn.com/b/scott_hanselman/archive/2011/10/28/asp-net-ie10-dopostback-javascript-ff5.aspx

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值