Jan
16
Written by:
Vizisoft Networks
16 January 2010 20:45
I have been using a lightbox script within a Dotnetnuke module, with the images inside an update panel. However, after an Aysnc Postback, the lightbox script stops working. Changing the postback to a normal postback the script still works, so it looks as if the injection of new html from the Ajax Update panel is causing the problem, probably unhooking the lighbox from the DOM. After some reserach and testing the following addition to the page load seems to have got the problems solved:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Page.IsPostBack Then
'Reinitialize lightbox on postback.
Dim cstype As Type = Me.GetType()
ScriptManager.RegisterStartupScript(Page, cstype, "init", "initLightbox();", True)
End If
Tags: