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"/>