how to pass parameter to javascript in asp.net
I need to pass an url from asp.net load_page to flow开发者_C百科player javascript function here: http://flowplayer.org/plugins/streaming/rtmp.html
How to do that ?
You can pass a value from ASP.NET to javascript like this:
In your page's code-behind create a property:
protected string MyValue { get { return "my value"; } }
In the markup, assign the value to a javascript variable:
<script>
var myValue = "<%= MyValue %>";
...
</script>
Now you can use this value in javascript.
C#
ScriptManager.RegisterStartupScript(this, this.GetType(), "_MyStartupJS", "JavaScriptFunctionNameToCall(param1Value, param2Value); ", true);
精彩评论