prettyPhoto inside an asp.net UpdatePanel fails, after post back
  • Hi!

    I'm using pP on my asp.net site in a ListView that is inside an updatePanel. I have placed the necessary script tags in the head section of my master page, and initializing prettyPhoto in the content page. When the page is rendered at the first time, everything seems to work as expected.

    But when the updatepanel gets updated, prettyPhoto seems not to work anymore. The image that was displayed in a lightbox way, now opens in a new browser window, alone.

    I have had some google around, and found that i need to insert an initialization script at every endRequest. So i have modified my code to show as below:


    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequest);

    function EndRequest(sender, args) {
    jQuery(document).ready(function () {
    jQuery("a[rel^='prettyPhoto']").prettyPhoto({ theme: 'facebook' });
    });
    }


    But this only works if i comment the normal initialization script on the content page, and works only at the first update.
    After the second update it fails aswell with the following messages:
    - Error: '$pp_pic_holder' is null or not an object
    - Error: '$ppt' is null or not an object

    I would really love to use this script on my page, so please help me to fix this.

    Appreciate every idea!!

    Thanks in advance!

    pistiee
  • Can you post what you have in your Master and Content pages?

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!