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 was getting this because my script was inside an Iframe that was being "disposed" (it was a Telerik "window" that was closed). The code defining _dopostback() inside my iframe was gone, but the code calling _dopostback() inside my iframe was still hanging around. Love that JavaScript!
Wrapping my server side controls in a
form
element withrunat="server"
attribute worked for me. According to asp environment there should be only oneform
element withrunat="server"
attribute in it otherwise some serious issue may happen.i used this method in my script that included to asp.net form:
For me it was the following was missing from the page:
Here's why this was happening to me: I accidentally forgot that script tags must always have closing tags:
I corrected the script tag:
and sanity returned.
__doPostBack Works guys
Write this code in Page Load
ClientScript.GetPostBackEventReference(this, "");