Thursday, October 28, 2010

ASP.NET UpdatePanel, jQuery and Async postback

It's common to have jQuery plug-in (or any other JS plug-in) to attach it's behavior to some DOM objects upon document load. It's usual for many plug-ins to subscribe to events of the elements of interest. A simple example, attach multiply row values behavior via JS plug-in to ASP.NET GridView control (which is rendered as a <table> element):



After page is loaded a new behavior is available to the grid veiw (in this case the plug-in simply recalculates values for row cells upon user input).

The problem may arise when the GridView control is inside an UpdatePanel and an sync postback occurs. In this case the old table is deleted and new markup is rendered in it's place. This means that old DOM elements are deleted and no active event subscriptions exist anymore. After postback plug-in behavior is not active and should be reattached once again. To this MS Ajax client library can be used to handle async postback event when reposnse is received and rendered:



Note: if the init script creates any DOM elements outside the update panel then duplicate elements can be created after async postbacks. This should be handled separately.

15 comments:

  1. Useful information.I am actual blessed to read this article.thanks for giving us this advantageous information.I acknowledge this post.and I would like bookmark this post.Thanks
    Python Online certification training
    python Training institute in Chennai
    Python training institute in Bangalore

    ReplyDelete
  2. Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.

    AWS Training in Bangalore | Best AWS Amazon Web Services…
    Amazon Web Services (AWS) Training in Pune India
    AWS Training | AWS Training and Certification | AWS online training
    AWS Training in Bangalore cost| Aws training in Bangalore with placements

    ReplyDelete
  3. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
    AWS Training in pune
    AWS Online Training

    ReplyDelete
  4. This is most informative and also this post most user friendly and super navigation to all posts. Thank you so much for giving this information to me.microsoft azure training in bangalore




    ReplyDelete
  5. This information is impressive..I am inspired with your post writing style & how continuously you describe this topic.

    Best Apache Spark Online Course
    Apache Spark and Scala Online Training

    ReplyDelete


  6. This post is so interactive and informative.keep update more information...
    Java Training in Bangalore
    Java Classes in Pune

    ReplyDelete
  7. This post is so interactive and informative.keep update more information...
    German Classes in Velachery
    German Classes in chennai

    ReplyDelete
  8. This is an awesome post. Really very informative and creative contents. Visit my website to get best Information About Best IAS coaching Institutes in Dadar.
    Best IAS coaching Institutes in Dadar
    Top IAS coaching Institutes in Dadar

    ReplyDelete
  9. Adobe Animate 2022 Full Version Crack allows users to access stunning fonts, ... Adobe Animate CC Crack Crack Serial key provides many unique things to its .https://cyberspc.com/adobe-animate-cc-free-download-with-crack/

    ReplyDelete
  10. This comment has been removed by the author.

    ReplyDelete