Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • mmmoustache 50 posts 79 karma points
    Jun 19, 2012 @ 10:42
    mmmoustache
    0

    Render script once document has loaded

    Hi Everyone,

    I have a razor script (along with some .NET & MySQL queries) and would like to render it once the document has fully loaded (currently the rendered data is displayed at the top of the page). I've been led to .NET's event handlers but when I use them in my code only plain text is rendered and the script does not run, is there something I need to reference to run the event handlers? Or is there are a razor version of say, 'Page_Load'?

    Following some documentation, an example of the event handler I have been using (which doesn't work):

    protected void Page_LoadComplete(object sender, EventArgs e)  {
    Response.Write("Page Load Complete!");
    }

    Kind Regards,
    mmmoustache

  • Jamie Pollock 174 posts 853 karma points c-trib
    Jun 19, 2012 @ 14:49
    Jamie Pollock
    0

    Hi mmmoustache,
    I believe in 4.7 or 4.7.1 they added the RenderEvent attribute to macro tags. It's an enum with the following values:

    1. Init (default value)
    2. PreRender
    3. Render

    If you set it to Render it might achieve what you're looking to do, but there are no guarantees it will work as expected.

    I hope this helps,
    Jamie

Please Sign in or register to post replies

Write your reply to:

Draft