How to pass javascript parameter in asp.net

I need to pass the url from asp.net load_page to the javascript flowplayer function here: http://flowplayer.org/plugins/streaming/rtmp.html

How to do it?

+3
source share
2 answers

You can pass the value from ASP.NET to javascript as follows:

In your code, create a property:

protected string MyValue { get { return "my value"; } }

In the markup, assign a value to the javascript variable:

<script>
var myValue = "<%= MyValue %>";
...
</script>

Now you can use this value in javascript.

+17
source

WITH#

ScriptManager.RegisterStartupScript(this, this.GetType(), "_MyStartupJS", "JavaScriptFunctionNameToCall(param1Value, param2Value); ", true);
+1
source

Source: https://habr.com/ru/post/1737841/


All Articles