ASP.NET MVC Razor in Depth on Display and Editor Templates

Post on 14-Jan-2015

14,782 views 0 download

Tags:

description

MVP Suthep Sangvirotjanaphat explains basic of ASP.NET MVC 4's Razor Html Helper on Display and Edit Templates. Then take a deeper demonstration in how we can achieve Polymorphism in ASP.NET MVC's Views. The result is we can have a simplified code that ready for changes and extensible in the future.

transcript

DEVELOPMENT, ADVANCED

Suthep Sangvirotjanaphatand http://GreatFriends.Biz Founder &

Instructor

THAILAND

ASP.NET MVC

Razor View Engine

in Depth on Display and Editor

Templates

Agenda

Razor supports for Displaying and Editing model.

DemonstrationHow we do Polymorphism and Encapsulation in View

Summary

ASP.NET MVC Razor View Engine in Depth on Display and Editor TemplateSuthep S. // Microsoft MVP & Instructor at http://GreatFriends.Biz .NET Training Center

The Basic

ASP.NET MVC Razor View Engine in Depth on Display and Editor TemplateSuthep S. // Microsoft MVP & Instructor at http://GreatFriends.Biz .NET Training Center

Display() and DisplayFor()

ASP.NET MVC Razor View Engine in Depth on Display and Editor TemplateSuthep S. // Microsoft MVP & Instructor at http://GreatFriends.Biz .NET Training Center

Editor() and EditorFor()

ASP.NET MVC Razor View Engine in Depth on Display and Editor TemplateSuthep S. // Microsoft MVP & Instructor at http://GreatFriends.Biz .NET Training Center

DisplayForModel()and EditorForModel()

ASP.NET MVC Razor View Engine in Depth on Display and Editor TemplateSuthep S. // Microsoft MVP & Instructor at http://GreatFriends.Biz .NET Training Center

TemplatesTemplate

View

Output

ASP.NET MVC Razor View Engine in Depth on Display and Editor TemplateSuthep S. // Microsoft MVP & Instructor at http://GreatFriends.Biz .NET Training Center

The Goal Setting

The Goal

ASP.NET MVC Razor View Engine in Depth on Display and Editor TemplateSuthep S. // Microsoft MVP & Instructor at http://GreatFriends.Biz .NET Training Center

UI Design

ASP.NET MVC Razor View Engine in Depth on Display and Editor TemplateSuthep S. // Microsoft MVP & Instructor at http://GreatFriends.Biz .NET Training Center

ASP.NET MVC Razor View Engine in Depth on Display and Editor TemplateSuthep S. // Microsoft MVP & Instructor at http://GreatFriends.Biz .NET Training Center

ASP.NET MVC Razor View Engine in Depth on Display and Editor TemplateSuthep S. // Microsoft MVP & Instructor at http://GreatFriends.Biz .NET Training Center

ASP.NET MVC Razor View Engine in Depth on Display and Editor TemplateSuthep S. // Microsoft MVP & Instructor at http://GreatFriends.Biz .NET Training Center

ASP.NET MVC Razor View Engine in Depth on Display and Editor TemplateSuthep S. // Microsoft MVP & Instructor at http://GreatFriends.Biz .NET Training Center

The Design

Solving the problem.

ASP.NET MVC Razor View Engine in Depth on Display and Editor TemplateSuthep S. // Microsoft MVP & Instructor at http://GreatFriends.Biz .NET Training Center

Initial Class Design

ASP.NET MVC Razor View Engine in Depth on Display and Editor TemplateSuthep S. // Microsoft MVP & Instructor at http://GreatFriends.Biz .NET Training Center

ASP.NET MVC Razor View Engine in Depth on Display and Editor TemplateSuthep S. // Microsoft MVP & Instructor at http://GreatFriends.Biz .NET Training Center

ASP.NET MVC Razor View Engine in Depth on Display and Editor TemplateSuthep S. // Microsoft MVP & Instructor at http://GreatFriends.Biz .NET Training Center

ASP.NET MVC Razor View Engine in Depth on Display and Editor TemplateSuthep S. // Microsoft MVP & Instructor at http://GreatFriends.Biz .NET Training Center

ASP.NET MVC Razor View Engine in Depth on Display and Editor TemplateSuthep S. // Microsoft MVP & Instructor at http://GreatFriends.Biz .NET Training Center

Final Class Analysis

ASP.NET MVC Razor View Engine in Depth on Display and Editor TemplateSuthep S. // Microsoft MVP & Instructor at http://GreatFriends.Biz .NET Training Center

Area of Polymorphism

ASP.NET MVC Razor View Engine in Depth on Display and Editor TemplateSuthep S. // Microsoft MVP & Instructor at http://GreatFriends.Biz .NET Training Center

Demonstration

How we do Polymorphism and Encapsulation in View

ASP.NET MVC Razor View Engine in Depth on Display and Editor TemplateSuthep S. // Microsoft MVP & Instructor at http://GreatFriends.Biz .NET Training Center

Summary

We can do polymorphism in ASP.NET MVC View.

That’s mean, we can successfully separate

what to show and how to show apart.

(Yes, we call it encapsulation)

Make our View adaptable and extensible possible.

ASP.NET MVC Razor View Engine in Depth on Display and Editor TemplateSuthep S. // Microsoft MVP & Instructor at http://GreatFriends.Biz .NET Training Center

Thank You

ASP.NET MVC Razor View Engine in Depth on Display and Editor TemplateSuthep S. // Microsoft MVP & Instructor at http://GreatFriends.Biz .NET Training Center

Download this slides and demo project at

http://bit.ly/mvc-razor http://bit.ly/mvc-razor-demo

Contact me at suthep@GreatFriends.biz http://facebook.com/suthep or join the community at http://www.GreatFriends.biz

Always welcome for questions or discussions about ASP.NET MVC and other .NET technologies

http://www.facebook.com/groups/greatfriends.biz/ http://www.facebook.com/groups/MVCTHAIDEV/http://www.facebook.com/groups/html5dev/

GreatFriends.Biz courses taught by Thailand’s Microsoft Most Valuable Professionals (MVP)

We provide a quality public and in-house training courses for you and your team. Please visit us at http://greatfriends.biz More than 2,000 developers & SAs highly satisfy us.