【问题标题】:Update Panel hangs in ASP.NET with large gridview result更新面板在 ASP.NET 中挂起,gridview 结果很大
【发布时间】:2015-11-05 12:18:22
【问题描述】:

在我的代码中,我有一个更新面板,它会挂起一个很大的结果。

<asp:UpdatePanel ID="up1" EnableViewState="false" runat="server" UpdateMode="Conditional">
                            <ContentTemplate>
                            <div id="tablediv" style="width:1250px;height:100%;overflow:hidden;margin: 0px auto 0px auto;padding-top:35px;padding-bottom:15px;">

                                <div class="ScrollableDiv" style="max-height:100%;width:100%;overflow-y:auto;">
                                    <asp:GridView ID="gvResults"
                                        runat="server" 
                                        AlternatingRowStyle-CssClass="AlternateRow" RowStyle-CssClass="MainRow"
                                        AutoGenerateColumns="false"
                                        ShowHeader="false"
                                        DataKeyNames="pomOrdernum"
                                        CellPadding="0"
                                        CellSpacing="0"
                                        GridLines="None"
                                        >.... </asp:Gridview>
...
</ContentTemplate>
.... 
</UpdatePanel>

我有一个 asp:Button(它被隐藏并通过 javascript 进行点击),当按下它时,它将对数据进行排序,并使用排序后的结果更新 gridview。对于更大的数据集,这只会挂起。我有更多代码的省略号

【问题讨论】:

    标签: asp.net gridview updatepanel


    【解决方案1】:

    我发现当我尝试在更新面板之外提交视图状态的回发时,我收到“请求大小太大”错误。我发现它正在提交我用来跟踪绑定到 GridView 的 DataTable 的视图状态,并且这个视图状态元素对于 IIS 来说太大了。解决此问题的最简单方法是增加 web.config 中的最大请求长度

       <system.web>
        <sessionState timeout="60"/>
        <compilation debug="true" strict="false" explicit="true" targetFramework="4.5"/>
        <httpRuntime maxRequestLength="50000"/>
        <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
      </system.web>
    
      <system.webServer>
        <!--<directoryBrowse enabled="true" showFlags="Date,Time,Extension,Size" />-->
        <security>
          <requestFiltering>
            <requestLimits maxAllowedContentLength="51200000" />
          </requestFiltering>
        </security>
      </system.webServer>
    

    【讨论】:

      猜你喜欢
      • 2020-07-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多