更新面板在ASP.NET中挂起,具有较大的gridview结果

时间:2015-08-12 18:32:33

标签: asp.net gridview updatepanel

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

<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:按钮(它是隐藏的并通过javascript点击)按下时将进行数据排序并使用排序结果更新gridview。对于较大的数据集,这将挂起。我有省略号,其中有更多的代码

1 个答案:

答案 0 :(得分:0)

我发现当我尝试在更新面板之外提交视图状态的帖子时,我得到“请求大小太大”错误。我发现它正在提交我用来跟踪绑定到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>