0

Hello, I am attempting to use RegisterClientScriptBlock and it is not seeming to work. Can someone take a look at my code?

Here is my C# (which I have in my PageLoad)

var videoLoadScript = " var so = new SWFObject('player.swf','mpl','955',' 540','9');";

videoLoadScript += "so.addParam('allowscriptaccess','always');";

videoLoadScript += "so.addParam('allowfullscreen','true');";

videoLoadScript += "so.addParam('flashvars','&file='" + path + "'&autostart=true');";

videoLoadScript += "so.write('player');";

ClientScript.RegisterClientScriptBlock(this.GetType(), "test", videoLoadScript, true);

Here is my HTML (which I have in my BODY tag):

<div id="player" oninit="test();" align="center">This text will be replaced</div>

does anyone see anything obviously wrong?

2
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by SaraJo
0

Hello,

I'm guessing that you have this C# in your code-behind file correct? If so, this is what I would write instead...

//all code up to the RegisterClientScriptBlock call is ok...
//Call the RegisterStartupScript method instead, it has the same signature as the
//RegisterClientScriptBlock method.
ClientScript.RegisterStartupScript(this.GetType(), "test", videoLoadScript, true);

Hope this helps...

0

That was my thought as well, but RegisterStartupScript gave me the same result :(

0

I had an extra tick mark in my function, thanks for your help!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.