"zion" <zi**@msn.comwrote in message
news:O4**************@TK2MSFTNGP04.phx.gbl...
In my Aspx.cs page in Page_load event I have for example:
String x;
x = "10";
How can I use the x value in a javascript function in the Aspx page?
One way to do it is to write <%= x %inside your javascript code in the
aspx page in the place where you want to access x. Note that this will only
work if x is a public field or method inside your class, so it can't be a
local variable of the Page_Load method.
Another way is to build the javascript code inside your server code. You
can then concatenate into the code the value of any variables that you want,
such as the local variable x, and then you send this javascript into the
page by means of any of the methods provided for this purpose, such as
ClientScript.RegisterClientScriptBlock.