I have looked at similar questions on Stack Overflow but haven't been able to find the solution to this particular problem. I have a simple (not really, but let's pretend) ASP.NET page with an update panel inside it.
In this update panel there is a HiddenField control with a value that will be set/updated via my own custom JavaScript. The value is updated as I can see in the DOM using Firebug.
Next to this HiddenField there is a LinkButton which calls the JavaScript to modify the value of the HiddenField using OnClientClick (this works). The LinkButton also has an OnClick handler which is executed after the value has been modified.
However, in the OnClick handler, I get the initial value of the HiddenField and not the value which was set by JavaScript!
Why is this? Is this a case of "PEBKAC"?
EDIT: Tried the same thing with a TextBox without any success. Also tried modifying the value manually using Firebug before submitting the form, without any success.
EDIT 2: I just realised that Page_Load is called before the OnClick handler, which was messing things up. I will not delete the question as other people may have the same problem and may find this question valuable.