Quantcast

Shadowbox breaks after paging data

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Shadowbox breaks after paging data

Steve
Hello,

We're running a pet contest, where people can enter their pets and eventually vote for their favorite. Anyways, The pets are displayed in a grid, that has paging functionality. On the first page you can click on an image in the grid, and it opens the shadowbox viewer, but as soon as you hit the next button, the script breaks (no errors in error console). The grid is inside of an asp.net update panel to suppress postbacks when paging. Here's the link to see it in action: http://www.kdhnews.com/petcontest/default.aspx

Usually there is a conflict with another script whenever shadowbox breaks, but I'm no JavaScript expert, and the lack of errors doesn't help either. I'm baffled. Please help.

Thanks :)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shadowbox breaks after paging data

Steve
Well, no answers yet, but I figured out a solution. It's quite simple, actually. After each AJAX call, I simply call Shadowbox.setup(); in my code. Since I'm using ASP.NET, that would be in the form of ScriptManager.RegisterStartupSrcipt().

Maybe this will help someone else.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shadowbox breaks after paging data

Eugene
Hello Steve,

I am having the similar problem. I used it to pop up another page and it works find when the page is first loaded. But after I do post back within Ajax Update Panel it redirect to the popup page instead of opening it in shadowbox.

I followed your solution and put the following line in Page_Load but it does not work.

ScriptManager.RegisterStartupScript(Me, Me.GetType(), "shadowbox", "Shadowbox.init({players:[""iframe""]});", True)

Do you have any advice for me?

Thank you.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shadowbox breaks after paging data

Steve
I have some paging links on my page, which call a subroutine that takes care of the paging. At the end of the sub, just before I bind the data, I put this code:

ScriptManager.RegisterStartupScript(Me, GetType(String), "mykey", "Shadowbox.setup();", True)

I suggest you put that in whatever method is handling your AJAX request, not the page load sub.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shadowbox breaks after paging data

Haris
here is how I solved the issue:

added following JS code in aspx file:

var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_pageLoaded(setupSB);

function setupSB() {
            Shadowbox.init({ skipSetup: true });
            Shadowbox.clearCache();
            Shadowbox.setup();
}
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shadowbox breaks after paging data

Rahul Kumar
i too got the same issue with the shadow box where i was unable to get my shadow box work as it was redirecting to a blank page...but after going through various forums i solved my issue and i would like to post the answer here........may be anyone can get some help with this..

just paste this javascript code in ur aspx page
 <script type="text/javascript"> Shadowbox.init(); Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequest); function EndRequest(sender, args) { Shadowbox.setup(); } </script>
you need to make sure that this code is run below the scriptmanager code...otherwise the problem will still persist..Thanking you..
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shadowbox breaks after paging data

anederea
Rahul, thanks a lot!
i spent hours on it
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shadowbox breaks after paging data

Adam Harold
In reply to this post by Rahul Kumar
You deserve an electronic high five. Nice work. ^5
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shadowbox breaks after paging data

Ashraf
In reply to this post by Rahul Kumar
Thaks
Loading...