Starting with DNN 5.6.3, ASP.NET Event Validation was turned on (see wiki article). As a result, there can be an error when submitting a form with web controls that have been dynamically changed via JavaScript. For example, I have a drop down list that is filled via a web service call (based on a selection in another drop down list).
When trying to post that form, this is the error that comes back:
Uncaught Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
Page.ClientScript.RegisterForEventValidation has three overloads:
From the MSDN documentation, it appears that these need to register the control generating the event, rather than the control with unexpected changes. So, in my scenario where there's a dynamic drop down list on a settings page, I would need to register the settings page's Update button, rather than my drop down list. That said, it seems more likely that I'd need to register the drop down list, and I've seen some examples of that reported working, so I don't fully trust the documentation here.
Does anyone have an example of what would need to be called in this scenario to allow my unexpected drop down value to get past event validation?