Thursday, March 29, 2012

Setting properties dynamically for an embedded video

I have an aspx page which embeds a video. Based on an input parameter
id, the appropriate video is played.
I've hard coded most the of "<object>" and "<embed"> paramters in the
HTML. However, the video source needs to be read and populated based on
database content..
How can I do this? My HTML is something like this .
<OBJECT blah blah>
<PARAM NAME="SRC" VALUE="VIDEO URL GOES HERE"
<EMBED blah blah src="http://pics.10026.com/?src=VIDEO URL GOES HERE">
</EMBED>
</OBJECT>
I need my aspx code to insert the Video URL in the appropriate places.Hi!
An easy way is to add a Literal control to the location where you want to
embed the markup and then build the markup in code. You have a lot of
control over it that way. Here's the idea:
Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim sbObjectTag As New System.Text.StringBuilder
Dim strURL As String
strURL = "http://www.myplace.ca"
sbObjectTag.Append("<OBJECT blah blah>")
sbObjectTag.Append("<PARAM NAME='SRC' ")
sbObjectTag.Append("VALUE='")
sbObjectTag.Append(strURL)
sbObjectTag.Append("' <EMBED blah blah src="http://pics.10026.com/?src=)
sbObjectTag.Append(strURL)
sbObjectTag.Append("' </EMBED></OBJECT>")
Literal1.Text = sbObjectTag.ToString
End Sub
<form id="Form1" method="post" runat="server">
<asp:literal id="Literal1" runat="server"></asp:literal>
</form>
Does this help?
Ken
Microsoft MVP [ASP.NET]
Toronto
<b_naick@.yahoo.ca> wrote in message
news:1106234788.761465.278790@.c13g2000cwb.googlegroups.com...
>I have an aspx page which embeds a video. Based on an input parameter
> id, the appropriate video is played.
> I've hard coded most the of "<object>" and "<embed"> paramters in the
> HTML. However, the video source needs to be read and populated based on
> database content..
> How can I do this? My HTML is something like this .
> <OBJECT blah blah>
> <PARAM NAME="SRC" VALUE="VIDEO URL GOES HERE"
> <EMBED blah blah src="http://pics.10026.com/?src=VIDEO URL GOES HERE">
> </EMBED>
> </OBJECT>
> I need my aspx code to insert the Video URL in the appropriate places.
>

0 comments:

Post a Comment