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 (lightBoxPlayer2.show();) 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
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 (lightBoxPlayer2.show();) 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("window.onload=function(e){");
//cstext2.Append("window.load=function(e){");
cstext2.Append("openLightboxPlayer('" + urlFile + "');");
cstext2.Append("}</
script
>");
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 %>');
// lightBoxPlayer.show();
var lightBoxPlayer2 = $find('LightBoxPlayer').show();
lightBoxPlayer2.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"
/>
</
ClientSettings
>
<
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"
>
</
audio
>
<
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
>
</
div
>
</
div
>
</
ItemTemplate
>
</
telerik:RadLightBoxItem
>
</
Items
>
</
telerik:RadLightBox
>