use Colobox with ASP.NET Ajax

 Colorbox is built on Jquery library,  by default, the colorbox link only works when the first time it loads or postback etc.  However ASP.NET Ajax is partial postback,  so after ajax update you may find colobox are not working any more.

Below post describes the problem on Jquery with Ajax update panel and provide a good solution

http://www.dotnetfunda.com/articles/article471-jquery-and-aspnet-ajax-updatepanel-.aspx

It can be used on colorbox as well, open jquery.colorbox.js  and add a function “pageLoad” ,and copy the content from “$(document).ready(function(){” to “pageLoad”

$(document).ready(function(){
     $(“.example7″).colorbox({width:”80%”, height:”80%”, iframe:true});
});
 
function pageLoad(sender,args){

if (args.get_isPartialLoad())

   {
       $(“.example7″).colorbox({width:”80%”, height:”80%”, iframe:true});

   }

}

   



 

Advertisements