I have a User Control in which I want to inject script into the page that looks somewhat like this:
<script>
var mydata = {
a: 123,
b: “text”,
c: [1,3,4]
};
</script>
I've tried various approaches as outlined here: https://msdn.microsoft.com/en-us/library/ms178207%28v=vs.140%29.aspx?f=255&MSPPError=-2147217396
Here's an example of some code I've attempted to do this with:
Page.ClientScript.RegisterStartupScript(this.GetType(), "MenuIndex", "var myData = {a:123, b:'text', c:[1,3,4]};");
However, no matter what I've tried, the script doesn't show up in the Page.
What am I doing wrong?
Robert
Go to the complete details ...