开发者

how to pass parameter to javascript in asp.net

开发者 https://www.devze.com 2022-12-23 08:31 出处:网络
I need to pass an url from asp.net load_page to flow开发者_C百科player javascript function here:

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消