Click here to Skip to main content
Click here to Skip to main content

Using jQuery Shadowbox Inside ASP.NET UpdatePanel

, 7 Jan 2010
Rate this:
Please Sign up or sign in to vote.
The original source of this article is taken from The home of all .NET developers - Using JQuery Shadowbox Inside ASP.NET UpdatePanel. I recommend that you read those useful articles related to the .NET framework for more tips and tricks.Shadowbox is an amazing extension for JQuery that...
The original source of this article is taken from The home of all .NET developers - Using JQuery Shadowbox Inside ASP.NET UpdatePanel. I recommend that you read those useful articles related to the .NET framework for more tips and tricks.
 
Shadowbox is an amazing extension for JQuery that allows you to easily play around with image galleries, modal dialogs,internal pages and much more while providing a rich user interface that captures the eye. It is also easy to implement in your web pages. However, .net developers often lose the functionality of shadowbox if they are using it from inside an update panel which is part of the microsoft ajax framework.
 
Shadowbox does not work inside the update panel becuase the content within the panel is dynamically updated after a partial postback. This causes the bindings of shadowbox on the inner html content to break and therefore, the nice shadowbox will not open again.
 
However, there is a nice little workaround to fix this issue. The solution is easy to implement and configure on you current project. All we need to do is reinitialize shadowbox after a partial postback is complete. This will cause html elements to rebind to shadowbox to get up and running again. The script below shows how to do this on the page you are using shadowbox or in the master page if you are using one.
 
<script type="text/javascript">
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequest);
    function EndRequest(sender, args) {Shadowbox.setup();}
</script>

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Ali Tarhini
Software Developer (Senior) Microgen
Lebanon Lebanon
For more articles and extreme topics please check out my personal website www.alitarhini.com

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 7 Jan 2010
Article Copyright 2009 by Ali Tarhini
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid