+ All Categories
Home > Technology > ASP.NET MVC Razor in Depth on Display and Editor Templates

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

Date post: 14-Jan-2015
Category:
Upload: suthep-sangvirotjanaphat
View: 14,782 times
Download: 0 times
Share this document with a friend
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.
Popular Tags:
25
DEVELOPMENT, ADVANCED Suthep Sangvirotjanaphat and http://GreatFriends.Biz Founder & Instructor THAILAND ASP.NET MVC Razor View Engine in Depth on Display and Editor Template s
Transcript
Page 1: ASP.NET MVC Razor in Depth on Display and Editor Templates

DEVELOPMENT, ADVANCED

Suthep Sangvirotjanaphatand http://GreatFriends.Biz Founder &

Instructor

THAILAND

ASP.NET MVC

Razor View Engine

in Depth on Display and Editor

Templates

Page 2: ASP.NET MVC Razor 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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 [email protected] 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/

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

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.


Recommended