Ajax SmartPart only working in Page Edit Mode

Sep 22, 2010 at 10:53 PM


I have a problem in that my Ajax SmartParts are only working when the page is in Edit Mode on MOSS 2007.

When in edit mode, the form consists of:
<body scroll="yes" onload="javascript:if (typeof(_spBodyOnLoadWrapper) != 'undefined') _spBodyOnLoadWrapper();">
    <form name="aspnetForm" method="post" action="TeamStructures.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="aspnetForm">

And this correctly deals with the Sharepoint/Ajax issue.

However, when not in edit mode, the form tag is:
<body scroll="yes" onload="javascript:if (typeof(_spBodyOnLoadWrapper) != 'undefined') _spBodyOnLoadWrapper();">
    <form name="aspnetForm" method="post" action="TeamStructures.aspx" id="aspnetForm" onsubmit="_spFormOnSubmitWrapper();">

And this is causing my postback to be "blocked" due to the commonly known spformonsubmitwrapper issue.

Anyone had anything similar before? It's only happening in one of my web applications.


Jan 11, 2011 at 3:12 PM

Hi there,
if you still have the problem (or anyone else), we came across the same issue with a custom web part using the ASP.NET AJAX controls in one of our web applications.

The problem was that the security validation was turned off for the web application which had the issue.
The setting can be turned on under Central Administration -> Application Management -> Web Application General Settings -> Web Page Security Validation.
With this set to on, the WebForm_OnSubmit() function is always used.

Hope this helps.

Sep 5, 2012 at 11:52 AM

Hi Retep

I have a similar problem

I recently migrated a Moss 2007 solution to SP2010, which has a lot of custom user controls which were hosted on the page through smartpart. Once the site is migrated to Sp2010, some of the user controls only are working in the edit page mode rather than the view mode. I have applied the web page security validation as mentioned above, but no luck with the behaviour.


Any solutions here?

Sep 12, 2012 at 1:43 PM

I was able to fix the problem

It was a conflicting ajax version for .net 3.5, as we move the application from .net 2.0. In summary I had to change the scriptmanager to ToolkitScriptManager in the masterpage, and it fixed most of the issues