I have this html code for embedding a video in an aspx page:
<OBJECT ID="MediaPlayer" WIDTH="192" HEIGHT="190" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
STANDBY="Loading Windows Media Player components..." TYPE="application/x-oleobject">
<PARAM NAME="FileName" VALUE="videofilename.wmv">
<PARAM name="autostart" VALUE="false">
<PARAM name="ShowControls" VALUE="true">
<param name="ShowStatusBar" value="false">
<PARAM name="ShowDisplay" VALUE="false">
<EMBED TYPE="application/x-mplayer2" SRC="videofilename.wmv" NAME="MediaPlayer"
WIDTH="192" HEIGHT="190" ShowControls="1" ShowStatusBar="0" ShowDisplay="0" autostart="0"> </EMBED>
</OBJECT>
The thing is, I want to set its parameters from my C# code-behind (f.e., the path to the file to be played).
I know I should add runat="server" but that’s not the only thing. The code-behind doesn’t recognize any element of the type MediaPlayer no matter what. (I’m trying to access it from my Page_Load(..))
How should I do this?
10x
Create a
HtmlGenericControl. You can set the attributes through theAttributesproperty via your codebehind. And add the sub-elements throughControls.