Common_CustomControls_CSharp\ADFWebPart\AJAXSharePointWebPart.cs
// Copyright 2010 ESRI // // All rights reserved under the copyright laws of the United States // and applicable international laws, treaties, and conventions. // // You may freely redistribute and use this sample code, with or // without modification, provided you include the original copyright // notice and use restrictions. // // See the use restrictions. // using System; using System.Collections.Generic; using System.Text; namespace ADFWebPart { public abstract class AJAXSharePointWebPart: System.Web.UI.WebControls.WebParts.WebPart { protected override void OnInit(System.EventArgs e) { base.OnInit(e); // Fix problem with postbacks and form actions (DevDiv 55525) Page.ClientScript.RegisterStartupScript(GetType(), this.ID, "_spOriginalFormAction = document.forms[0].action;", true); // By default, the onsubmit event for forms in SharePoint master pages call "return _spFormOnSubmitWrapper()" // which blocks async postbacks after the first one. Not calling "_spFormOnSubmitWrapper()" breaks all postbacks // and defeats the purpose of _spFormOnSubmitWrapper() which is to block repetitive postbacks. // To call _spFormOnSubmitWrapper() and allow partial postbacks, remove "return" from the original call. if (this.Page.Form != null) { string formOnSubmitAtt = this.Page.Form.Attributes["onsubmit"]; if (!string.IsNullOrEmpty(formOnSubmitAtt) && formOnSubmitAtt == "return _spFormOnSubmitWrapper();") { this.Page.Form.Attributes["onsubmit"] = "_spFormOnSubmitWrapper();"; } } } } }