开发者

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜