I'm using
__doPostBack(clientIdOfSomeButton, someData);
to create a PostBack in JavaScript. The problem is that someData
is not known in advance, and event validation kicks in because I cannot ClientScript.RegisterForEventValidation
every possible value of someData
.
So far, I can see only two possibilities to solve this problem:
- Turn off event validation for the page, which is not recommended for security reasons.
- Instead of passing the data via event validation, put the data in some hidden text field via JavaScript and then call
__doPostBack
. That's ugly.
Is there some third option that I've missed? Ideally, I'd like something like ClientScript.RegisterForEventValidationIgnoreArguments(myButton)
, but something like this does not exist...