Dynde
Dynde

Reputation: 2674

Asp.net AJAX working - but not working

This is a weird one.

Long story short: wrote a usercontrol using AJAX. Used return of smart part v1.3 to plug it into a sharepoint 2007 (development) site.

Works perfectly!

Moved it all to a production server - modified the web.config file to be exactly like the development site. It's not working.

It's weird because, I'm pretty sure the ajax is actually working, since the updateprogress is working, and I get an error in my ajax_endrequest js handler - after my second ajax request (as in - I press a button once, nothing, I press it again) I get:

"Invalid postback or callback argument. Event validation is enabled using in configuration..."

I have a linkbutton with javascript__doPostback, which seems to work - at least it's running the code - but it's not updating anything in the updatepanel.

Another example of it not working: I have a tab-panel, and a listbox set to autocomplete. In the selectedindexchanged I change the active tab panel - but this isn't working. When I do it twice I get the same aforementioned error back in my javascript end request handler.

Can ANYONE point me in ANY direction!? :)

Upvotes: 0

Views: 1341

Answers (2)

Dynde
Dynde

Reputation: 2674

Okay...

I have to vent. This problem took me way too long to fix.

The problem was in the masterpage in sharepoint. Since I wasn't using the default masterpage, apparently this line:

<WebPartPages:SPWebPartManager runat="server"/>

Was outside the tag - when it's moved down inside it (which is is in the default-masterpage, I was using on my development machine), everything works great -.-

I hate sharepoint sometimes...

Upvotes: 1

bleepzter
bleepzter

Reputation: 9985

I think because you are using AJAX you are running into issues with event validaiton. Since the JavaScript is firing events, ASP.NET cannot verify the source of the triggered event handlers thus throwing errors left and right.

You can disable event validation globaly:

<system.web>
   <pages enableEventValidation="false"/>
</system.web>

or on a single page:

<%@ Page EnableEventValidation="false" ... %>

The same applies for view state validation... on controls that JavaScript has interacted on... And here is the code to fix it:

web config:

<pages enableViewState="false" />

or on a single page:

<%@ Page ... EnableViewState="false" %>

Upvotes: 0

Related Questions