asp.net mvc from the ground up
DESCRIPTION
TRANSCRIPT
![Page 1: ASP.NET MVC From The Ground Up](https://reader035.vdocuments.mx/reader035/viewer/2022080209/54bd888e4a7959644c8b4593/html5/thumbnails/1.jpg)
ASP.NET MVC From The Ground UpKevin Griffin
![Page 2: ASP.NET MVC From The Ground Up](https://reader035.vdocuments.mx/reader035/viewer/2022080209/54bd888e4a7959644c8b4593/html5/thumbnails/2.jpg)
About Me
• .NET Developer• Chesapeake, VA
• Microsoft Client App Dev MVP• Leader of the Hampton Roads .NET Users Group• ASPInsider• INETA Mentor for Virginia
![Page 3: ASP.NET MVC From The Ground Up](https://reader035.vdocuments.mx/reader035/viewer/2022080209/54bd888e4a7959644c8b4593/html5/thumbnails/3.jpg)
Before We Begin
• Ask questions• Enjoy the conference, leave if you’re not getting
what you expected
![Page 4: ASP.NET MVC From The Ground Up](https://reader035.vdocuments.mx/reader035/viewer/2022080209/54bd888e4a7959644c8b4593/html5/thumbnails/4.jpg)
* From The Ground Up
• Assumptions• You MIGHT be a WebForms Developer• You know nothing about ASP.NET MVC• You’ve tried to sit through MVC talks before and
had trouble• No TDD or IOC mantra today• Just a basic discussion of MVC
![Page 5: ASP.NET MVC From The Ground Up](https://reader035.vdocuments.mx/reader035/viewer/2022080209/54bd888e4a7959644c8b4593/html5/thumbnails/5.jpg)
Agenda
• What is MVC?• Components of MVC• Controllers• Views• Models• Ditching the Blue Screen
![Page 6: ASP.NET MVC From The Ground Up](https://reader035.vdocuments.mx/reader035/viewer/2022080209/54bd888e4a7959644c8b4593/html5/thumbnails/6.jpg)
What Is MVC?
• Model View Controller• ASP.NET MVC is an alternative way to build web
applications on the ASP.NET platform.• Not a replacement to WebForms
![Page 7: ASP.NET MVC From The Ground Up](https://reader035.vdocuments.mx/reader035/viewer/2022080209/54bd888e4a7959644c8b4593/html5/thumbnails/7.jpg)
Let’s get it out of the way
• Web Forms vs. MVC
![Page 8: ASP.NET MVC From The Ground Up](https://reader035.vdocuments.mx/reader035/viewer/2022080209/54bd888e4a7959644c8b4593/html5/thumbnails/8.jpg)
MVC Routes
• Convention over Configuration• Default Route• http://domain/Controller/Action/ID• Customizable
![Page 9: ASP.NET MVC From The Ground Up](https://reader035.vdocuments.mx/reader035/viewer/2022080209/54bd888e4a7959644c8b4593/html5/thumbnails/9.jpg)
Controller
• BRAIN of the application• Receives input from requests• Performs logic or data requests
![Page 10: ASP.NET MVC From The Ground Up](https://reader035.vdocuments.mx/reader035/viewer/2022080209/54bd888e4a7959644c8b4593/html5/thumbnails/10.jpg)
Model
• Representation of the data required to present a view or to send data back to the server.
![Page 11: ASP.NET MVC From The Ground Up](https://reader035.vdocuments.mx/reader035/viewer/2022080209/54bd888e4a7959644c8b4593/html5/thumbnails/11.jpg)
View
• The stuff you want to show on the screen.• Bind with a model to provide a data
![Page 12: ASP.NET MVC From The Ground Up](https://reader035.vdocuments.mx/reader035/viewer/2022080209/54bd888e4a7959644c8b4593/html5/thumbnails/12.jpg)
DEMOStarting From Scratch
![Page 13: ASP.NET MVC From The Ground Up](https://reader035.vdocuments.mx/reader035/viewer/2022080209/54bd888e4a7959644c8b4593/html5/thumbnails/13.jpg)
ActionResults
• How MVC returns data• You specify what you want to return, and MVC
handles the response.
![Page 14: ASP.NET MVC From The Ground Up](https://reader035.vdocuments.mx/reader035/viewer/2022080209/54bd888e4a7959644c8b4593/html5/thumbnails/14.jpg)
ActionResults• ViewResult – Represents HTML and markup rendered by a view.• ContentResult – Represents a text result.• EmptyResult – Represents no result.• FileContentResult – Represents a downloadable file (with the binary
content).• FilePathResult – Represents a downloadable file (with a path).• FileStreamResult – Represents a downloadable file (with a file stream).• JavaScriptResult – Represents a JavaScript script.• JsonResult – Represents a JavaScript Object Notation result that can be
used in an AJAX application.• PartialViewResult – Represents HTML and markup rendered by a partial
view.• RedirectResult – Represents a redirection to a new URL.• RedirectToRouteResult – Represents a result that performs a
redirection by using the specified route values dictionary.
![Page 15: ASP.NET MVC From The Ground Up](https://reader035.vdocuments.mx/reader035/viewer/2022080209/54bd888e4a7959644c8b4593/html5/thumbnails/15.jpg)
DEMOAdding New Views
![Page 16: ASP.NET MVC From The Ground Up](https://reader035.vdocuments.mx/reader035/viewer/2022080209/54bd888e4a7959644c8b4593/html5/thumbnails/16.jpg)
HTML Helpers
• Extension Methods• Helps you render HTML content easily• Replacement for server controls?• Create your own!
![Page 17: ASP.NET MVC From The Ground Up](https://reader035.vdocuments.mx/reader035/viewer/2022080209/54bd888e4a7959644c8b4593/html5/thumbnails/17.jpg)
What Is A Model?
• Loosely typed• ViewData dictionary• Strong typed• Bind to a custom object
![Page 18: ASP.NET MVC From The Ground Up](https://reader035.vdocuments.mx/reader035/viewer/2022080209/54bd888e4a7959644c8b4593/html5/thumbnails/18.jpg)
DEMOModeling Our View
![Page 19: ASP.NET MVC From The Ground Up](https://reader035.vdocuments.mx/reader035/viewer/2022080209/54bd888e4a7959644c8b4593/html5/thumbnails/19.jpg)
Thanks For Attending!
• Questions?!• [email protected]• Twitter: @1kevgriff• http://www.kevgriffin.com