ASP.NET ScriptManager Error: this._forum is not a object

I happened a few times to receive this error on an ASP.NET page that contains a ScriptManager and a link to a JavaScript file inside the Head tag on the page, like this:

[...]
<head runat="server">
    <script type="text/javascript" src="../Scripts/barcode.js" />
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <div>
    [...]

Apparently the code is without errors, but running the page in debug mode, you receive an error like this:

Microsoft Javascript: object needed

Microsoft Javascript: object needed

By clicking on the button “Stop”, I’m going to try to understand what might have happened, and I realize that the object “_form” of the page does not exist, or is “null”

this._form is NULL

this._form is NULL

Needless to tell you how long I spent trying to figure out what could have happened, and where could be a possible error, of course without success.

After a meticulous search on the internet, I finally found an article that enlightened and saved me .
It seems to be a small bug of ScriptManager object, which misinterprets the tag <script /> without explicit locking.

It was sufficient change the tag and use the canonical syntax to solve it all:

<head runat="server">
    <script type="text/javascript" src="../Scripts/barcode.js" >
    </script>
</head>

End of the ordeal.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s