3

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

How to do that ?

1
  • Well, you're missing a few steps between asp.net and JavaScript (namely, a web server and a client). What do you have so far? Commented Mar 20, 2010 at 19:57

2 Answers 2

17

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.

Sign up to request clarification or add additional context in comments.

2 Comments

This is how I do it most of the time.
Thanks that seems simple enough, I'll try.
1

C#

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.