PageRequestManagerServerErrorException (status code 500)
In a quick AJAX demo I had to create today, I ran into a (somewhat cryptic) PageRequestManagerServerErrorException. I needed a simple form of the Cascading Dropdown{.}, one that doesn’t use a (web)service for its data, but gets it from a simple method. Here’s the setup, and the cause…
Lets start with the exact error message:
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500
I needed 2 DropDownLists working together to enable users to first select a month, and then select a day. Of course, you want the second DropDownList to only display days available for the chosen month. Because of that I had two dropdownlists in an updatepanel, and set the first one to AutoPostback so it would trigger the updatepanel. The first one had items set to something like this:
When setting items throught the IDE, this HTML is generated:
«/FONT>asp:ListItem>«/FONT>select item></asp:ListItem>
«/FONT>asp:ListItem>First item</asp:ListItem>
«/FONT>asp:ListItem>Second one</asp:ListItem>
Because the value property for the items wasn’t set explicitly, it is generated (or should we say substracted?) from the information that was entered. Therefore, the Value property of the first item was ‘
«/FONT>asp:ListItem Value=”0″>«/FONT>select item></asp:ListItem>
«/FONT>asp:ListItem Value=”1″>First item</asp:ListItem>
«/FONT>asp:ListItem Value=”2″>Second one</asp:ListItem>
Notice the Value attribute in the ListItem tag? That’s the one that will keep your project from throwing a PageRequestManagerServerErrorException.