Skip to content

Instantly share code, notes, and snippets.

@darrenshrwd
Created August 20, 2014 04:29
Show Gist options
  • Save darrenshrwd/dbe0452440b55d0013c9 to your computer and use it in GitHub Desktop.
Save darrenshrwd/dbe0452440b55d0013c9 to your computer and use it in GitHub Desktop.
faster_layout
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title</title>
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")"></script>
...
...
</head>
<body>
<p>Before Body</p>
@if (IsSectionDefined("AsyncBody")) {
var sb = ((StringWriter)ViewContext.Writer).GetStringBuilder();
Response.Write(sb);
Response.Flush();
sb.Length = 0;
@RenderSection("AsyncBody");
}
else {
@RenderBody();
}
<p>After Body</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment