I have a script based on .NET & Razor that renders on a webpage immediately, before any html elements have been rendered. Apart from a MySQL query, the script is solely writing some of the data onscreen using:
Response.Write("Some data");
I'm using Umbraco v4.7.2 and would like the script to render where I inserted the macro, after the whole document has loaded. I've tried wrapping my script in an event handler, similar to the following, but this isn't recognised and causes the whole script to render as text:
protected void Page_LoadComplete(object sender, EventArgs e) {
Response.Write("Page Load Complete!");
}
Event handlers seem to be used frequently but I don't quite understand the Umbraco documentation, is there something I need to reference in my razor script in order for them to render? Is there a 'cs' file I need to reference?
I've also tried using the 'RenderEvent' attribute, which based on my script doesn't appear to do anything.