asp.net中listview+datapager+updatepanel在IE中报12031错误

    在UpdatePanel中使用listview进行分页局部更新时,默认情况下,在IE中可能会出现“Sys.WebForms.PageRequestManagerServerErrorException: An unknow error occurred while processing the request on the server . The status code returned from the server was: 12031”或代号为404,示例代码如下:

 

<asp:UpdatePanel ID="UpdatePanelTest" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                    <asp:ListView ID="ListView2" runat="server" DataKeyNames="WorkId"
                            DataSourceID="SqlDataSource1">
                        <ItemTemplate>
                            <tr style="background-color: #FFFFFF;color: #000000;">
                                <td>
                                    <asp:Label ID="WorkContentLabel" runat="server" Text='<%# Eval("WorkContent") %>' /></td>
                            </tr>
                        </ItemTemplate>
                        <EmptyDataTemplate>
                            <table id="Table1" runat="server"
                                style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
                                <tr>
                                    <td>
                                        目前还没有数据可以显示</td>
                                </tr>
                            </table>
                        </EmptyDataTemplate>
                        <LayoutTemplate>
                            <table id="Table2" runat="server">
                                <tr id="Tr1" runat="server">
                                    <td id="Td1" runat="server">
                                        <table ID="itemPlaceholderContainer" runat="server" border="1"
                                            style="background-color: #FFFFFF;border-collapse: collapse;border-color: #000000;border-style:solid;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif; padding:6px; margin:0px; text-align:center">
                                            <tr id="Tr2" runat="server" style="background-color: #859CB6; color: #006666; font-size: 15pt; font-weight: bold; text-align:center">
                                                <th id="Th1" runat="server">序号</th>
                                            </tr>
                                            <tr ID="itemPlaceholder" runat="server">
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr id="Tr3" runat="server">
                                    <td id="Td2" runat="server"
                                        style="text-align: center;background-color: #5D7B9D;font-family: Verdana, Arial, Helvetica, sans-serif;color: #FFFFFF">
                                      <asp:DataPager ID="DataPager2" runat="server" PageSize="5">
                                            <Fields>
                                                <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowLastPageButton="true" ShowNextPageButton="true" ShowPreviousPageButton="true" />
                                            </Fields>
                                        </asp:DataPager>
                                       
                                    </td>
                                </tr>
                            </table>
                        </LayoutTemplate>
                    </asp:ListView>

                </ContentTemplate>   
                </asp:UpdatePanel>

但是上述错误在firefox中却没有,本人调试了两天,终于解决了问题,方法如下:

在本页面script脚本的开始出加入:

if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
        Sys.Application.add_load(function()
            {
                var form = Sys.WebForms.PageRequestManager.getInstance()._form;
                form._initialAction = form.action = window.location.href;
            });

即可,至于原理,可参照http://www.pin5i.com/showtopic-26101.html所述

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值