This is a migrated thread and some comments may be shown as answers.

Deep Linking

2 Answers 45 Views
LightBox
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 22 Feb 2014, 11:54 AM
Hi,

Is it possible to open the LightBox on page load by using a QueryString value - like the Deep linking function in PrettyPhoto for example?

Cheers,

Jack

2 Answers, 1 is accepted

Sort by
0
Accepted
Viktor Tachev
Telerik team
answered on 26 Feb 2014, 03:12 PM
Hello Jack,

I am not sure I completely understand the functionality you would like to achieve. Are you trying to open a specific item in RadLightBox on page load based on a query string? Or you would like to have the url in the address bar changed for every photo in the RadLightBox?

If you would like to have the former functionality you could use an approach similar to the one described in this article. As illustration a button click is used in the article, however you could use different event like pageLoad().

In case you would like to implement the latter, I am afraid that such functionality is not available for the control. In this case you could use the DescriptionTemplate of a RadLightBoxItem and add a control that holds the path to the currently displayed image.

If I have misunderstood what you would like to achieve, would you elaborate in greater detail about the scenario that you would like to implement?

Regards,
Viktor Tachev
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
0
Jon
Top achievements
Rank 1
answered on 13 Mar 2014, 10:29 AM
Yes thank you Viktor.

Got it working now. Cheers, Jack

 Private Sub RegisterJSOpenLightBox(ByVal _lbid As String)

        Dim cstype As Type = Me.[GetType]()
        Dim csname As String = "OpenLightBox"
        Dim cs As ClientScriptManager = Page.ClientScript

        If Not cs.IsClientScriptBlockRegistered(cstype, csname) Then
            Dim cstext2 As New StringBuilder()
            cstext2.Append("<script type=""text/javascript"">")
            cstext2.Append("window.onload=function(e){")
            cstext2.Append((Convert.ToString("OpenLightBox" + _lbid + "();")))
            cstext2.Append("}</script>")
            cs.RegisterClientScriptBlock(cstype, "OpenLightBox", cstext2.ToString())
        End If
    End Sub

 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If lbID > 0 Then
            RegisterJSOpenLightBox(lbID)
        End If
    End Sub

ReadOnly Property lbID() As Integer
        Get
            If Not Request.QueryString("lbid") Is Nothing Then
                lbID = Request.QueryString("lbid")
            Else
                lbID = 0
            End If
            Return CInt(lbID)
        End Get
    End Property
Tags
LightBox
Asked by
Jon
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Jon
Top achievements
Rank 1
Share this question
or