Setting properties dynamically for an embedded video

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.
 
K

Ken Cox [Microsoft MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top