Question

I'm getting a peculiar javascript error with IE. I have an updatepanel, and inside it a drop down list. When I change the dropdownlist's value, it gives me error "Line: 5 '__EVENTTARGET' is null or not an object'. I took a look, and this Line 5 and __EVENTTARGET are in the ASP.NET generated javascript code.

I want a dropdownlist that fires method when new option selected, with no page flicker.

Here's some of my code :

<asp:ScriptManager ID="uxScriptMan" runat="server" />
<asp:UpdatePanel ID="uxtestupdatepanel" runat="server">
<ContentTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" 
    AutoPostBack="true" OnSelectedIndexChanged="TESTMETHOD">
 <asp:ListItem Text="TEST" Selected="true" />
 <asp:ListItem Text="Yes" Value="1" />
 <asp:ListItem Text="No" Value="0" />
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>

and

protected void TESTMETHOD(object sender, EventArgs e) { /*do nothing*/ }

In Firefox, it works, no errors. And in fact, on dev machine, uncompiled soln with .aspx and .aspx.cs files, no errors in IE. On production machine, compiled, I get IE js errors.

Whats the problem, how do i fix, or at least, where can I start looking? Done a ton of googling with not much luck.

Was it helpful?

Solution 3

Fixed it! It was a combination of Duck and ck's comments.

Thanks guys.

It was a web.config problem. This particular application's web.config was different from a few other applications we had been using on our servers. Here's the fixes for anyone else who ever has this problem.

Incorrect web.config:

<compilation debug="false">
        <assemblies>
            <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        </assemblies>
    </compilation>


 <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
            <bindingRedirect oldVersion="1.0.61025.0" newVersion="3.5.0.0"/>
        </dependentAssembly>
    </assemblyBinding>
</runtime>

Correct web.config:

<compilation debug="false">
  <assemblies>
    <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
  </assemblies>

OTHER TIPS

A shot in the dark, does your server have the same service packs as your development environment?

If you're using .NET 3.5 SP1, the service pack makes a big difference and could account for the odd discrepancy.

Do you have the same web.config in both? Your production one may be missing the resource handler for ScriptResource.axd

Try setting the ScriptManager EnablePartialRendering property

EnablePartialRendering="false"

And see if you still get an error

Also try turning off event validation on that page

<%@ Page EnableEventValidation="false" %>

And see if you still get an error

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top