ASP.NET Podcast Show #121 - Phil Haack with an ASP.NET MVC Demo - Video
Subscribe to M4V for iPod Users.
Subscribe to MP3 (Audio only).
Show Notes:
- Phil Haack comes on the show and gives a simple ASP.NET MVC Demo.
- Source Code is below and downloadable.
Source Code:
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="MvcApplication2.Views.Home.Index" %>
<asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server">
<h2><%= Html.Encode(ViewData["Message"]) %></h2>
<p>
To learn more about ASP.NET MVC visit <a href="http://asp.net/mvc" title="ASP.NET MVC Website">http://asp.net/mvc</a>.
</p>
Region 1: <span id="region1"></span>
<hr />
Region 2:<span id="region2"></span>
<p>
<input type="button" onclick="DoSomething()" value="Click Me" />
</p>
<script type="text/javascript">
function DoSomething() {
$.getJSON("/Home/GetJson", null, function(data) {
$("#region1").text(data.Message1);
flash('#region1');
$("#region2").text(data.Message2);
flash('#region2');
});
}
function flash(selector) {
$(selector)
.css('opacity', 0)
.animate({ backgroundColor: 'khaki', opacity: 1.0 }, 800)
.animate({ backgroundColor: '#ffffff' }, 350, function() {
this.style.removeAttribute('filter');
});
}
</script>