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

,

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: