__doPostBack is not defined

Viewed 83472

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

26 Answers

Here's why this was happening to me: I accidentally forgot that script tags must always have closing tags:

<script src="/Scripts/appLogic/Regions.js" />

I corrected the script tag:

<script src="/Scripts/appLogic/Regions.js" type="text/javascript" ></script>

and sanity returned.

For me it was the fact that I was using a custom User-Agent Header of User-Agent: This is a Test, please ignore.

This is because IIS ASP.NET Webforms generates web pages depending on the User-Agent string.

To fix it, I included the browser types, plus a message at the end, i.e.

User-Agent: Mozilla/5.0 (X11; Linux x86_64) Chrome/75.0.3770.80 (This is a Test, please ignore)

And the page started running correctly again.

i had this error and i solved it by inserting :

<form runat="server" style="display: none"></form>

Wrapping my server side controls in a form element with runat="server" attribute worked for me. According to asp environment there should be only one form element with runat="server" attribute in it otherwise some serious issue may happen.

<form runat="server" id="form1">
   <!-- Server side controls go here -->
</form>
Related