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 getting that Javascript error.
i was looking in the internet and the only thing i read is that this error happends when i have a unclose tag but i review the site and its ok.
Error: __doPostBack is not defined Source File: htt://localhost:99/ProjectName/Disable.aspx Line: 1
I had this problem just today, but none of the solutions I found worked, unfortunately including yours. So if someone reads this and it doesn't work for them try this
http://you.arenot.me/2010/11/03/asp-net-__dopostback-is-not-defined/
Cheers though for helping me through the process of working out what went wrong!
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):
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.
Just add this code to your .aspx
Old question but recent answer: if you have a
ScriptManager
, check ifEnablePartialRendering
is enabled. If so, disable it, I don't know why it's a problem there...For me "__doPostBack" did not work in all pages because I compiled my project with newer version of Visual stdio then I double clicked on properties in solution explorer and changed "Target framework " from .Net framework 4.0 to .Net framework 3.0 and after that rebuild project and it worked.
Solution for my Problem: IIS ASP.NET Webforms generates web pages depending on user Agent string
My IIS had no definition for the IE11 browser so it defaulted to a very simple browser profile which doesn't even Support JavaScript.
An alternative: set IE11 Browser definiton file