Skip to content

Instantly share code, notes, and snippets.

@nberardi
Created March 20, 2014 14:35
Show Gist options
  • Save nberardi/9665119 to your computer and use it in GitHub Desktop.
Save nberardi/9665119 to your computer and use it in GitHub Desktop.
Example For Flushing Before Execution for Nik Molnar
public class HomeController : Controller {
public ActionResult Index () {
ViewBag.ExecuteAction = () => {
// do stuff here
return model;
};
return View();
}
}
<html>
<head>
@* some scripts and other things here *@
</head>
<body>
<h1>My awesome page</h1>
@{ Response.Flush() }
@{ var model = ViewBag.ExecuteAction(); }
<h2>@model.Title</h2>
<p>@model.Content</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment