I have a webcontrol with two dropdownlists on in. When you choose something from the first, the second is populated accordingly. When post back occurs I get the old:
Invalid postback or callback argument. Event validation is enabled using 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.
I know what this problem is; I am populating the dropdown with unexpected data. I've read up on the error and found fixes like overriding the Render method where you call "RegisterForEventValidation" for each new dropdownlist item. I can't do this, however, as I am repopulating the dropdown client side.
In theory I could use this method if I added every possible value (around 3000) that could be included in the dropdown, but I didn't really want to do this.
Are there any other ways of getting around this error, without disabling EventValidation or populating the dropdownlist server side?