Im getting that error when try to call a __doPostBack on one of my pages, every page that i have in the project use __doPostBack function but in this particular page im gett
Essentially what's going on is that there are 2 missing html hidden elements "eventtarget" and "eventargument", as well as a missing function "__doPostBack".
These are missing from the DOM.
I tried all the fixes listed for this and none worked. However using a combination of jquery and javascript there is an unobtrusive solution. Add this to your javascript on document ready and you're off to the races (This is a much quicker alternative than installing the .net framework 4.5 on your server, although if you can install 4.5 thats the way to go):
if ($('#__EVENTTARGET').length <= 0 && $('#__EVENTARGUMENT').length <= 0) {
$('#YOUR_ASPNET_FORMID').prepend('');
}
if (typeof __doPostBack == 'undefined') {
__doPostBack = function (eventTarget, eventArgument) { object
var theForm = document.forms['YOUR_ASPNET_FORMID'];
if (!theForm) {
theForm = document.YOUR_ASPNET_FORMID;
}
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
};
}
I understand that some of said installing 4.5 fixes this. I would definitely recommend that. However, if you're like me working on an enterprise public facing site with a cms system baked in .net 4, this might just be an easier solution, as opposed to possibly introducing new bugs created from updating your platform.