This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> | |
... | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AsyncModel<T> | |
{ | |
private readonly Func<T> _controllerCode; | |
public AsyncModel(Func<T> controllerCode) | |
{ | |
_controllerCode = controllerCode; | |
} | |
public T Execute() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@{ | |
ViewBag.Title = "Home"; | |
} | |
@section AsyncBody { | |
@{ViewData.Model = Model.Execute();} | |
<p>From faster index: @Model.Text</p> | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private class SomeModelDemoOnly | |
{ | |
public string Text { get; set; } | |
} | |
// Traditional way | |
public ActionResult Index() | |
{ | |
Thread.Sleep(5000); // Do lots of DB and network stuff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Playing with background-attachment | |
*/ | |
pre { | |
max-height: 150px; | |
border: 1px solid silver; | |
overflow: auto; | |
background: url('http://placekitten.com/200/200'); | |
color: white; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Scrolling shadows by @kizmarh */ | |
html { | |
background: #FFF; | |
} | |
.scrollbox { | |
position: relative; | |
z-index: 1; |