在写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