On loading the page I want to pass a value to my javascript function from a server side variable.
I cannot seem to get it to work this is what I have:
Asp.Net
protected void Page_Load(object sender, EventArgs e)
{
string blah="ER432";
}
Javascript
<script type="text/javascript">
var JavascriptBlah = '<%=blah%>';
initObject.backg.product_line = JavascriptBlah;
</script>
Adding this to the page
public string blah { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
blah="ER432";
}
I still am getting an error: CS0103: The name 'blah' does not exist in the current context
Also I would like to try and accomplish this without using hdden fields
scripttag is in the page that has the .aspx.cs containingpublic string blah { get; set; }declared in it and the page has declared that .aspx.cs file as its code behind right?