SlideShare a Scribd company logo
BUILD YOUR WEB APPLICATION WITH ASP.NET MVC 2 FROM SCRATCHZZ Black Coffee #5 : Web ProgrammingChalermponAreepong : Nine (นาย)Greatfriends community leadMicrosoft MVP : ASP.NET
AgendaDemo Fast build web mvc application RoutingControlModelViewUnit TestingExtend MVC 2 DI/ Ajax/ Telirik MVC UIQuestion / Answer
Demo Fast build web mvc application
RoutingResponsibilityMap request to controller actionCreate out going Url corresponds with controller actionRoute PatternDefault parameter valueroutes.aMapRoute(“simple”, “{controller}/{action}/{id}”, new {id=“”});Constraints with Regular ExpressionCacheable - Data parameter
ControllerAction Method{action}  =  controller methodParameter{controller}/{action}/{id}  {id} = parameter for controller methodMulti parameter {controller}/{action}/{id},{name}routes.MapRoute(“hello,”say/hello/{id},{name}”, new { Controller = “say”, action = “hello”});Default parameter test([DefaultValue(10)]int max) {…}C#4 test(int max = 10) {…}
Controller (2)ActionResult is abstract class for return action result typeViewResult, RedirectResult, JsonResult, etc.Accept Verb[HttpGet] ActionResult Edit(string id){…}[HttpPost]  ActionResult Edit(string id, FormCollection form) {…}Asynchronous Controller
VIewStrong Typed Viewspublic partial class Index : ViewPage<Product> {…}Controller  : return View(product);ViewModel custom class to render view by requirementHtml Helper classViewEngine
ModelViewModelInputReportDomainModelBusiness ObjectBusiness RuleBusiness MethodData AccessORMRepository Pattern
Extend mvcAJAXRequired MicrosoftAjax.js, MicrosoftMvcAjax.jsSample code  view<%: Using(Ajax.BeginForm(“HelloAjax”, new AjaxOptions { UpdateTargetId = “results”})) {  %><%: Html.Textbox(“query”, null, new {size=40}) %> <input type=“submit /><% } %><div id=“results”> </div>Sample code controllerpublic ActionResultHelloAjax(string query) { if(Request.IsAjaxRequest()){ return Content(“You entered” + query);}else { return RedirectToAction(“Index”, new {query = query}); }}
Ad

Recommended

Beyond the current state
Beyond the current state
Armin Pašalić
 
Angularjs
Angularjs
sanjay joshi
 
Fancy Features in Asp.Net Core SignalR
Fancy Features in Asp.Net Core SignalR
Vladimir Georgiev
 
Async
Async
Kevin Griffin
 
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
SoftServe
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVC
Joe Wilson
 
Custom routing in asp.net mvc
Custom routing in asp.net mvc
Capgemini India
 
MVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros Developer
Nyros Technologies
 
Asp.net mvc 4
Asp.net mvc 4
Milestone Internet Marketing
 
Samza sql stream processing meetup
Samza sql stream processing meetup
Srinivasulu Punuru
 
Asp.net mvc basic introduction
Asp.net mvc basic introduction
Bhagath Gopinath
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVC
Sunpawet Somsin
 
React vs-angular-mobile
React vs-angular-mobile
Michael Haberman
 
Baking With Cake Php
Baking With Cake Php
valberg
 
Introduction to Angular JS
Introduction to Angular JS
Santhosh Kumar Srinivasan
 
2019-05-16 aOS Luxembourg - 6 - Flow avancé - Serge Luca
2019-05-16 aOS Luxembourg - 6 - Flow avancé - Serge Luca
aOS Community
 
Membangun Moderen UI dengan Vue.js
Membangun Moderen UI dengan Vue.js
Froyo Framework
 
MVC ppt presentation
MVC ppt presentation
Bhavin Shah
 
Asp.net mvc
Asp.net mvc
Naga Harish M
 
Mvc3 crash
Mvc3 crash
Melick Baranasooriya
 
Ember.js for Big Profit
Ember.js for Big Profit
CodeCore
 
ASP .NET MVC
ASP .NET MVC
eldorina
 
Angular.js - An introduction for the unitiated
Angular.js - An introduction for the unitiated
thehoagie
 
Use IBM Graph from NodeJS
Use IBM Graph from NodeJS
Alaa Abou Mahmoud
 
Introduction to AngularJS
Introduction to AngularJS
Shyjal Raazi
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
Thomas Robbins
 
Developing great applications using ASP.NET MVC and ASP.NET AJAX
Developing great applications using ASP.NET MVC and ASP.NET AJAX
Tatham Oddie
 
GraphQL IndyJS April 2016
GraphQL IndyJS April 2016
Brad Pillow
 
J query
J query
Chalermpon Areepong
 
Gf vtzz-05--j queryshowcase
Gf vtzz-05--j queryshowcase
Chalermpon Areepong
 

More Related Content

What's hot (20)

Asp.net mvc 4
Asp.net mvc 4
Milestone Internet Marketing
 
Samza sql stream processing meetup
Samza sql stream processing meetup
Srinivasulu Punuru
 
Asp.net mvc basic introduction
Asp.net mvc basic introduction
Bhagath Gopinath
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVC
Sunpawet Somsin
 
React vs-angular-mobile
React vs-angular-mobile
Michael Haberman
 
Baking With Cake Php
Baking With Cake Php
valberg
 
Introduction to Angular JS
Introduction to Angular JS
Santhosh Kumar Srinivasan
 
2019-05-16 aOS Luxembourg - 6 - Flow avancé - Serge Luca
2019-05-16 aOS Luxembourg - 6 - Flow avancé - Serge Luca
aOS Community
 
Membangun Moderen UI dengan Vue.js
Membangun Moderen UI dengan Vue.js
Froyo Framework
 
MVC ppt presentation
MVC ppt presentation
Bhavin Shah
 
Asp.net mvc
Asp.net mvc
Naga Harish M
 
Mvc3 crash
Mvc3 crash
Melick Baranasooriya
 
Ember.js for Big Profit
Ember.js for Big Profit
CodeCore
 
ASP .NET MVC
ASP .NET MVC
eldorina
 
Angular.js - An introduction for the unitiated
Angular.js - An introduction for the unitiated
thehoagie
 
Use IBM Graph from NodeJS
Use IBM Graph from NodeJS
Alaa Abou Mahmoud
 
Introduction to AngularJS
Introduction to AngularJS
Shyjal Raazi
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
Thomas Robbins
 
Developing great applications using ASP.NET MVC and ASP.NET AJAX
Developing great applications using ASP.NET MVC and ASP.NET AJAX
Tatham Oddie
 
GraphQL IndyJS April 2016
GraphQL IndyJS April 2016
Brad Pillow
 
Samza sql stream processing meetup
Samza sql stream processing meetup
Srinivasulu Punuru
 
Asp.net mvc basic introduction
Asp.net mvc basic introduction
Bhagath Gopinath
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVC
Sunpawet Somsin
 
Baking With Cake Php
Baking With Cake Php
valberg
 
2019-05-16 aOS Luxembourg - 6 - Flow avancé - Serge Luca
2019-05-16 aOS Luxembourg - 6 - Flow avancé - Serge Luca
aOS Community
 
Membangun Moderen UI dengan Vue.js
Membangun Moderen UI dengan Vue.js
Froyo Framework
 
MVC ppt presentation
MVC ppt presentation
Bhavin Shah
 
Ember.js for Big Profit
Ember.js for Big Profit
CodeCore
 
ASP .NET MVC
ASP .NET MVC
eldorina
 
Angular.js - An introduction for the unitiated
Angular.js - An introduction for the unitiated
thehoagie
 
Introduction to AngularJS
Introduction to AngularJS
Shyjal Raazi
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
Thomas Robbins
 
Developing great applications using ASP.NET MVC and ASP.NET AJAX
Developing great applications using ASP.NET MVC and ASP.NET AJAX
Tatham Oddie
 
GraphQL IndyJS April 2016
GraphQL IndyJS April 2016
Brad Pillow
 

Viewers also liked (6)

J query
J query
Chalermpon Areepong
 
Gf vtzz-05--j queryshowcase
Gf vtzz-05--j queryshowcase
Chalermpon Areepong
 
ZZ BC#7.5 asp.net mvc practice and guideline refresh!
ZZ BC#7.5 asp.net mvc practice and guideline refresh!
Chalermpon Areepong
 
ZZ BC#7 asp.net mvc practice and guideline by NineMvp
ZZ BC#7 asp.net mvc practice and guideline by NineMvp
Chalermpon Areepong
 
Build your website with angularjs and web apis
Build your website with angularjs and web apis
Chalermpon Areepong
 
DevRock #02 akka.net intro part
DevRock #02 akka.net intro part
Chalermpon Areepong
 
ZZ BC#7.5 asp.net mvc practice and guideline refresh!
ZZ BC#7.5 asp.net mvc practice and guideline refresh!
Chalermpon Areepong
 
ZZ BC#7 asp.net mvc practice and guideline by NineMvp
ZZ BC#7 asp.net mvc practice and guideline by NineMvp
Chalermpon Areepong
 
Build your website with angularjs and web apis
Build your website with angularjs and web apis
Chalermpon Areepong
 
Ad

Similar to Build your web app with asp.net mvc 2 from scratch (20)

ASP .net MVC
ASP .net MVC
Divya Sharma
 
Asp.Net Mvc
Asp.Net Mvc
sef2009
 
ASP.NET Routing & MVC
ASP.NET Routing & MVC
Emad Alashi
 
Asp.Net MVC Framework Design Pattern
Asp.Net MVC Framework Design Pattern
maddinapudi
 
Asp.Net Mvc Internals &amp; Extensibility
Asp.Net Mvc Internals &amp; Extensibility
Eyal Vardi
 
CTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVC
Barry Gervin
 
Asp.net mvc internals & extensibility
Asp.net mvc internals & extensibility
Eyal Vardi
 
ASP.NET MVC - Whats The Big Deal
ASP.NET MVC - Whats The Big Deal
Venketash (Pat) Ramadass
 
Asp.Net Mvc
Asp.Net Mvc
micham
 
ASP.NET MVC introduction
ASP.NET MVC introduction
Tomi Juhola
 
Introduction to ASP.Net MVC
Introduction to ASP.Net MVC
Sagar Kamate
 
Murach : HOW to work with controllers and routing
Murach : HOW to work with controllers and routing
MahmoudOHassouna
 
Day7
Day7
madamewoolf
 
ASP.NET MVC 2.0
ASP.NET MVC 2.0
Buu Nguyen
 
Introduction To Mvc
Introduction To Mvc
Volkan Uzun
 
Asp.Net MVC3 - Basics
Asp.Net MVC3 - Basics
Saravanan Subburayal
 
Hanselman lipton asp_connections_ams304_mvc
Hanselman lipton asp_connections_ams304_mvc
denemedeniz
 
MVC & SQL_In_1_Hour
MVC & SQL_In_1_Hour
Dilip Patel
 
ASP.NET MVC Controllers & Actions
ASP.NET MVC Controllers & Actions
onsela
 
LearningMVCWithLINQToSQL
LearningMVCWithLINQToSQL
Akhil Mittal
 
Asp.Net Mvc
Asp.Net Mvc
sef2009
 
ASP.NET Routing & MVC
ASP.NET Routing & MVC
Emad Alashi
 
Asp.Net MVC Framework Design Pattern
Asp.Net MVC Framework Design Pattern
maddinapudi
 
Asp.Net Mvc Internals &amp; Extensibility
Asp.Net Mvc Internals &amp; Extensibility
Eyal Vardi
 
CTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVC
Barry Gervin
 
Asp.net mvc internals & extensibility
Asp.net mvc internals & extensibility
Eyal Vardi
 
Asp.Net Mvc
Asp.Net Mvc
micham
 
ASP.NET MVC introduction
ASP.NET MVC introduction
Tomi Juhola
 
Introduction to ASP.Net MVC
Introduction to ASP.Net MVC
Sagar Kamate
 
Murach : HOW to work with controllers and routing
Murach : HOW to work with controllers and routing
MahmoudOHassouna
 
ASP.NET MVC 2.0
ASP.NET MVC 2.0
Buu Nguyen
 
Introduction To Mvc
Introduction To Mvc
Volkan Uzun
 
Hanselman lipton asp_connections_ams304_mvc
Hanselman lipton asp_connections_ams304_mvc
denemedeniz
 
MVC & SQL_In_1_Hour
MVC & SQL_In_1_Hour
Dilip Patel
 
ASP.NET MVC Controllers & Actions
ASP.NET MVC Controllers & Actions
onsela
 
LearningMVCWithLINQToSQL
LearningMVCWithLINQToSQL
Akhil Mittal
 
Ad

Build your web app with asp.net mvc 2 from scratch

  • 1. BUILD YOUR WEB APPLICATION WITH ASP.NET MVC 2 FROM SCRATCHZZ Black Coffee #5 : Web ProgrammingChalermponAreepong : Nine (นาย)Greatfriends community leadMicrosoft MVP : ASP.NET
  • 2. AgendaDemo Fast build web mvc application RoutingControlModelViewUnit TestingExtend MVC 2 DI/ Ajax/ Telirik MVC UIQuestion / Answer
  • 3. Demo Fast build web mvc application
  • 4. RoutingResponsibilityMap request to controller actionCreate out going Url corresponds with controller actionRoute PatternDefault parameter valueroutes.aMapRoute(“simple”, “{controller}/{action}/{id}”, new {id=“”});Constraints with Regular ExpressionCacheable - Data parameter
  • 5. ControllerAction Method{action} = controller methodParameter{controller}/{action}/{id} {id} = parameter for controller methodMulti parameter {controller}/{action}/{id},{name}routes.MapRoute(“hello,”say/hello/{id},{name}”, new { Controller = “say”, action = “hello”});Default parameter test([DefaultValue(10)]int max) {…}C#4 test(int max = 10) {…}
  • 6. Controller (2)ActionResult is abstract class for return action result typeViewResult, RedirectResult, JsonResult, etc.Accept Verb[HttpGet] ActionResult Edit(string id){…}[HttpPost] ActionResult Edit(string id, FormCollection form) {…}Asynchronous Controller
  • 7. VIewStrong Typed Viewspublic partial class Index : ViewPage<Product> {…}Controller : return View(product);ViewModel custom class to render view by requirementHtml Helper classViewEngine
  • 9. Extend mvcAJAXRequired MicrosoftAjax.js, MicrosoftMvcAjax.jsSample code view<%: Using(Ajax.BeginForm(“HelloAjax”, new AjaxOptions { UpdateTargetId = “results”})) { %><%: Html.Textbox(“query”, null, new {size=40}) %> <input type=“submit /><% } %><div id=“results”> </div>Sample code controllerpublic ActionResultHelloAjax(string query) { if(Request.IsAjaxRequest()){ return Content(“You entered” + query);}else { return RedirectToAction(“Index”, new {query = query}); }}