Ajax second postback not working in Sharepoint in UpdatePanel

We have one problem in work, we spend with that two days without any solution, all we found cause some another problem. This is what help us when the page is not making second postback in update panel when the first postback is fired by element in UpdatePanel and refresh only update panels on the page.

Taken from Mike Ammerlaan?s Blog

Windows SharePoint Services JavaScript has a ?form onSubmit wrapper? which is used to override the default form action.? This work is put in place to ensure that certain types of URLs, which may contain double byte characters, will fully work across most postback and asynchronous callback scenarios.? However, if your scenarios do not involve double byte character URLs, you may successful disable this workaround and gain the ability to use ASP.NET AJAX UpdatePanels.

To do this, you may need to register a client startup script which disables this workaround, in addition to resetting the default form action:

<script type='text/javascript'>
  _spOriginalFormAction = document.forms[0].action;
  _spSuppressFormOnSubmitWrapper=true;
</script>

This script may be directly embedded in the page, or could be emitted by a control that uses the UpdatePanel. The following is an example of a very simple method which will fix this issue:

private void EnsureUpdatePanelFixups()
{
  if (this.Page.Form != null)
  {<br />
    string formOnSubmitAtt = this.Page.Form.Attributes["onsubmit"];
    if (formOnSubmitAtt == "return _spFormOnSubmitWrapper();")
    {
      this.Page.Form.Attributes["onsubmit"] = "_spFormOnSubmitWrapper();";
    }
  }
  ScriptManager.RegisterStartupScript(this, typeof(AjaxUpdatePanelPart), "UpdatePanelFixup", "_spOriginalFormAction = document.forms[0].action; _spSuppressFormOnSubmitWrapper=true;", true);
}

Tagged on: , ,

84 thoughts on “Ajax second postback not working in Sharepoint in UpdatePanel

  1. ????

    I am no longer certain the place you’re getting your information, but great topic.
    I must spend some time finding out much more or working out more.
    Thanks for fantastic info I used to be looking for this information for
    my mission.

  2. ??? ?? ?? ??

    whoah this weblog is excellent i love studying your articles.
    Keep up the good work! You understand, a lot of individuals are hunting
    round for this information, you can help them greatly.

  3. ?? ??

    Thanks on your marvelous posting! I definitely enjoyed reading it,
    you can be a great author. I will remember to bookmark
    your blog and definitely will come back
    later in life. I want to encourage continue your great job, have a nice holiday weekend!

  4. ?? ?? ??

    Thanks a lot for sharing this with all of us you actually recognise what you’re talking approximately!
    Bookmarked. Kindly also visit my site =).
    We will have a link change arrangement between us

  5. 33???

    Thank you for every other informative site. Where else could I am getting
    that type of info written in such a perfect means?
    I have a mission that I’m simply now working on, and I have been on the look out for such information.

  6. ??? ??

    My brother recommended I might like this web site.
    He was once entirely right. This publish actually made my day.
    You can not believe simply how so much time I had spent for this information! Thank you!

  7. ?? ?? ? ??

    Thank you a lot for sharing this with all of us you really recognize what you’re speaking about!
    Bookmarked. Please additionally talk over with my website =).
    We will have a hyperlink change contract between us

  8. dbk222

    Republicans also pointed out that the aid to Ukraine was ultimately released, and that the Trump administration has provided more support — including lethal aid — than President Barack Obama ever did. They also cast Trump’s desire to have Zelensky investigate Biden as part of a broader push by both Washington and Kyiv to root out corruption in the Eastern European country.

  9. yeah77

    In the end, Wednesday’s hearing was likely only to harden opinions instead of changing them. Trump’s detractors will continue to see the Ukraine affair as evidence of the ineradicable corruption of his administration. The president’s supporters, meanwhile, are bound to treat impeachment as part of the enduring project to undo the results of the 2016 election.

  10. best373

    Perhaps the most insightful moment of the day came from Rep. Mark Meadows, R-N.C., who offered to reporters that “everybody has their interpretation of what truth is.”

  11. woorigame7

    Marine police used a boat Wednesday to help a group of mainland students leave the Chinese University of Hong Kong, which remained barricaded by demonstrators after violent clashes with police on Tuesday.

Leave a Reply

Your email address will not be published. Required fields are marked *