Code Render Blocks

Code Render Blocks

Code Render Blocks

  • Define inline code or inline expressions that execute when a page is rendered
    • <% inline code %> used to define self-contained lines or blocks of code 
    • <%=inline expression %> used as a shortcut for calling the Write method
  • The code inside the <% --%> tags is executed on the server
  • Example: <div><%Response.Write(now())%></div>
    • Response.Write is code for writing something to the HTML output stream
    • Now() is a function returning the servers current date and time
  • A function or subroutine cannot be declared within a code render block

Sources