0

I have a CheckBoxList into my update panel. The CheckBoxList displays filtered information from a table, the filter is based on the value selected in a dropdownlist. CheckBoxList addition I have also a checkbox inside the update panel, its function is to check or uncheck all the CheckBoxList items with one click.

Everything works fine, except when the CheckBoxList has many elements (thousands of items) and I click on the checkbox to uncheck once CheckBoxList items, then the following error occurs:

Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500

This error occurs in one of the ScriptResource.axd

I attach a simplified version that recreates the error:

Page Test.aspx:

<form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:DropDownList ID="ddlModelos" runat="server" AutoPostBack="True"
                    DataSourceID="odsModelos" DataTextField="nomb_modelo"
                    DataValueField="id_modelo">
                </asp:DropDownList>
                <asp:ObjectDataSource ID="odsModelos" runat="server"
                    OldValuesParameterFormatString="original_{0}"  SelectMethod="GetModelosHActivos"
                    TypeName="GlobalDB.DAL.DSGlobalDBTableAdapters.HMModelosTableAdapter">
                    <SelectParameters>
                        <asp:Parameter DefaultValue="True" Name="activo" Type="Boolean" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                <br />
                <asp:CheckBox ID="chbMarcar" runat="server" AutoPostBack="True"
                    oncheckedchanged="chbMarcar_CheckedChanged" Text="Select All" />
                <asp:CheckBoxList ID="chblSegmentos" runat="server" DataSourceID="odsSegmentos"
                    DataTextField="descripcion" DataValueField="id">
                </asp:CheckBoxList>
                <asp:ObjectDataSource ID="odsSegmentos" runat="server"
                    OldValuesParameterFormatString="{0}"
                    SelectMethod="GetHMDistribucionSegmentos"
                TypeName="GlobalDB.DAL.DSGlobalDBTableAdapters.HMSegmentosTableAdapter">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="ddlModelos" DefaultValue="0" Name="id_modelo"
                            PropertyName="SelectedValue" Type="Int32" />
                    </SelectParameters>
                </asp:ObjectDataSource>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="ddlModelos"
                    EventName="SelectedIndexChanged" />
            </Triggers>
        </asp:UpdatePanel>
    </div>
    </form> 

The code behind is this:

protected void chbMarcar_CheckedChanged(object sender, EventArgs e)
{
   foreach (ListItem item in chblSegmentos.Items)
      item.Selected = chbMarcar.Checked;
} 

The real page has many elements like this. So the Viewstate is great. All tests did show that this error only occurs when the CheckBoxList mentioned has thousands of items. Otherwise the error never occurs.

I have no idea how to fix this error. I have tried placing configurations such as this:

<pages enableEventValidation="false" maxPageStateFieldLength="30000" />
<httpRuntime maxRequestLength="40480"/>
4

2 回答 2

1

很久以前,我们在尝试在嵌套更新面板中呈现数百个 ASP.Net 图表控件时遇到了类似的问题。结果是 Javascript 错误,在 IE8 中是“内存不足”错误。

我们找到的唯一可接受的解决方案是减少页面上呈现的控件数量。

祝你好运,

达伦

于 2013-08-15T06:12:36.197 回答
0

最后我删除了视图状态以手动管理它,只保留回发之间的基本数据,视图状态大小大幅减小,问题消失了。

于 2013-08-30T22:43:02.590 回答