Open the LightBox after Loading the page

2 posts, 0 answers
  1. Jose
    Jose avatar
    10 posts
    Member since:
    Oct 2013

    Posted 28 Nov 2013 Link to this post

    Hi guys,

    I need to obtain an url from the server side and introduce it in a audio tag that is inside the LightBox. I register a JavaScript block from the server side and I want to open the LightBox when the page load, I call my RegisterJSOpenLightBox method on ItemCommand event.

    The problem is It works for many browsers but not with IE9. In IE9 when I try to open the lightbox with javascript (;) cannot find the lightbox. I try to register with $(document).ready but it doesn't work.
    Do you have any idea? I also used cstext2.Append("$(function() {"); .This is the error SCRIPT5007: Unable to get property 'show' of undefined or null reference 

    Thank you very much

    private void RegisterJSOpenLightBox(string urlFile)
        Type cstype = this.GetType();
        string csname = "OpenLightBox";
        ClientScriptManager cs = Page.ClientScript;
        if (!cs.IsClientScriptBlockRegistered(cstype, csname))
            StringBuilder cstext2 = new StringBuilder();
            cstext2.Append("<script type=\"text/javascript\">");
            cstext2.Append("openLightboxPlayer('" + urlFile + "');");
            cs.RegisterClientScriptBlock(cstype, "OpenLightBox", cstext2.ToString());

    function openLightboxPlayer(url) {
        var player = document.getElementById("AudioPlayer");
        player.src = url ;
        player.preload = "auto";
        // var lightBoxPlayer = $find('<= LightBoxPlayer.ClientID %>');
        var lightBoxPlayer2 = $find('LightBoxPlayer').show();;
        return false;
    <telerik:RadLightBox  ClientIDMode="Static"   ID="LightBoxPlayer" Width="500" Font-Size="Medium" runat="server"  Modal="true"  PreserveCurrentItemTemplates="true">
            <ClientSettings >
                <ClientEvents OnClosed="closeLightBox" />
                <AnimationSettings  HideAnimation="Resize" NextAnimation="Fade" PrevAnimation="Fade"  ShowAnimation="Resize" />
            <Items >
                <telerik:RadLightBoxItem  >
                    <ItemTemplate >
                        <div style="margin:0px 10px">
                              <asp:Label ID="lblClientNamePlayer" Font-Bold="true" runat="server" ></asp:Label><br />
                              <asp:Label ID="lblAppDatePlayer" Font-Bold="true" runat="server" ></asp:Label>                      
                              <audio id="AudioPlayer" runat="server" style="width:100%; margin-top:12px " controls preload="auto">     
                              <div style="text-align:center">
                                    <asp:Label ID="Label1"  Font-Bold="true" runat="server" >Click <asp:LinkButton ID="lnkDownloadAudio" runat="server" OnClick="DownloadAudio" Text="here"></asp:LinkButton> to download the recording  </asp:Label>                                  
  2. Jose
    Jose avatar
    10 posts
    Member since:
    Oct 2013

    Posted 29 Nov 2013 Link to this post

    I was calling  the method twice
    var lightBoxPlayer2 = $find('LightBoxPlayer').show();;
  3. DevCraft R3 2016 release webinar banner
Back to Top