OutputCache is magical but sometimes can be frustrating unless you know what is really going on.
I spent all day trying to understand what was going on and why was I not able to get to the server while using OutputCache and setting it up with my BulletedList's ListItems.
If you View Source on the web page, you will see the Javascript function below:
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
__doPostBack is a magical function to those who have not yet understood what it does and why it's there.
This baby will SET the hidden field, shown below, with the value you are trying to POST back to the server.
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
Normally, the Form will POST the name/value of the inputs fields in the Request.Form object as keys - However, the __doPostBack will use the __EVENTARGUMENT as the Name of the Key to store the value.
This solves any caching issues when dealing with controls that do not render as input fields like the asp:TextBox.
Current rating: 0 (0 ratings)