Hi I'm new here and I'm currently working with ASP.NET WebForms.
I had some issues trying to bind sources to a RadMediaPlayer that's inside a ASP Repeater:
The repeater source is provided by a stored procedure which is called in code-behind and then I use the "OnItemDataBound" event of the repeater to format each ItemTemplate. I'm doing all this steps because I'm working on a social network and I want to manage different posts (images,videos,songs,etc).
Here is the code-behind of the repeater event:
The data bind of the repeater is working fine, for example the images binding is perfect but not the audio binding. You can see the player there but when you press play nothing happens, it seems like the source isn't there but i checked with the javascript console of google chrome and the source is there.
Here is also the static class that provides the path to the project local folder where the files (images,songs,videos,etc) are stored:
I hope you can help me.
Thanks in advance.
John.
I had some issues trying to bind sources to a RadMediaPlayer that's inside a ASP Repeater:
<
asp:Repeater
ID
=
"Publicaciones"
runat
=
"server"
OnItemDataBound
=
"FormatearPublicaciones"
OnItemCommand
=
"Publicaciones_ItemCommand"
>
<
ItemTemplate
>
<
td
><%# Eval("PublicacionId")%></
td
>
<
td
><%# Eval("Mensaje")%></
td
>
<
td
><
asp:Image
ID
=
"PubImagen"
runat
=
"server"
ClientIDMode
=
"Static"
/></
td
>
<
td
>
<
telerik:RadMediaPlayer
ID
=
"PubAV"
runat
=
"server"
ClientIDMode
=
"Static"
Width
=
"350px"
Height
=
"250px"
></
telerik:RadMediaPlayer
>
<%--<
audio
id
=
"PubAudio"
runat
=
"server"
Width
=
"350px"
Height
=
"250px"
></
audio
>--%>
</
td
>
<
br
/>
<
br
/>
</
ItemTemplate
>
</
asp:Repeater
>
The repeater source is provided by a stored procedure which is called in code-behind and then I use the "OnItemDataBound" event of the repeater to format each ItemTemplate. I'm doing all this steps because I'm working on a social network and I want to manage different posts (images,videos,songs,etc).
Here is the code-behind of the repeater event:
protected
void
FormatearPublicaciones(Object Sender, RepeaterItemEventArgs e)
{
string
filename = ((MuroEntity)e.Item.DataItem).PubMultimediaRuta;
System.Web.UI.WebControls.Image imagenPub = e.Item.FindControl(
"PubImagen"
)
as
System.Web.UI.WebControls.Image;
Telerik.Web.UI.RadMediaPlayer avPub = e.Item.FindControl(
"PubAV"
)
as
Telerik.Web.UI.RadMediaPlayer;
if
(((MuroEntity)e.Item.DataItem).Tipo.Equals(
"F"
))
{
var imagenURL = Autenticado.Paths.Archivos +
"thumb_"
+ filename;
imagenPub.ImageUrl = imagenURL;
avPub.Visible =
false
;
}
else
if
(((MuroEntity)e.Item.DataItem).Tipo.Equals(
"C"
) || ((MuroEntity)e.Item.DataItem).Tipo.Equals(
"V"
))
{
avPub.Source = Autenticado.Paths.Archivos + filename;
imagenPub.Visible =
false
;
}
else
{
avPub.Visible =
false
;
imagenPub.Visible =
false
;
}
}
The data bind of the repeater is working fine, for example the images binding is perfect but not the audio binding. You can see the player there but when you press play nothing happens, it seems like the source isn't there but i checked with the javascript console of google chrome and the source is there.
Here is also the static class that provides the path to the project local folder where the files (images,songs,videos,etc) are stored:
public
static
class
Paths
{
public
static
readonly
string
Archivos =
"~/Archivos/"
+ SessionHelper.UsuarioAutenticado.Id.ToString() +
"/"
;
// cannot change
public
static
readonly
string
Archivos2 =
"Archivos/"
+ SessionHelper.UsuarioAutenticado.Id.ToString() +
"/"
;
//public static int Total = 5; // can change because not const
}
I hope you can help me.
Thanks in advance.
John.