Setting properties dynamically for an embedded video

  • Thread starter Thread starter b_naick
  • Start date Start date
B

b_naick

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="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=")
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
 
Back
Top