Julien Pinquié

ASP.NET, C#, SQL Server, Windows Live

How to resolve "__doPostBack is not defined" error

It just happened to me... I put my script in an file and declare it in the header like this :

<script src="js/masterpage.js" type="text/javascript" />

When I launch the page, I get a javascript error __doPostBack is not defined and none of my javascript functions is executed.

It seems that some tags need a closing tag and don't understand "/>", it's the case of the script tag but not of link, used to call my css style sheets for example. Using this code works :

<script src="js/masterpage.js" type="text/javascript"></script>

Comments

gfshshshshs said:

bal amio to parchchi na

# January 15, 2009 9:05 AM

jaimedp said:

Thanks, I was fighting with this!!

# February 23, 2009 5:28 PM

jgoemat said:

I had the problem because I overrode the user agent in FireFox and ASP.NET couldn't figure out which AJAX code to use.  I would hope that you could set the default somehow for unknown user agents...

# July 9, 2010 11:34 AM

colin.wiseman said:

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:

you.arenot.me/.../asp-net-__dopostback-is-not-defined

Cheers though for helping me through the process of working out what went wrong!

# November 3, 2010 5:08 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)