Uploading Data From Microsoft Excel - Microsoft SLQ Server 2008 (by Rakesh Mi...
Mvc 4 0_jayant_jindal_28082010
1. MVC ASP .Net VS 2010 Jayant Jindal jayantjindal@hotmail.com
2. Key Take Aways… Why MVC? What is MVC? How to Implement MVC? ASP .Net VS 2010 MVC Enhancements…
3. Why MVC? Easier code maintenance and support. Supports automated unit testing tools such as NUnit, MBUnit,... Decouple business and presentation application layers. Web-based thin-client application. User interface logic tends to change more frequently than business logic.
11. Trap all client requests, and controller decides which view or .aspx to render.Client Request Central Controller MyPage2 ASPX HTML View MyPage1 ASPX HTML View
12.
13. View: This refers to the UI components that will show the model data.Controller: This controls when to change the view, based on user actions. MVC design is not a replacement to the n-tier architecture. The model, the view, and the controller are not related directly to the layers, or to the physical tiers; they are logical components that operate together in a certain pattern.
14.
15. REST: Representation State Transfer Architectural pattern used to identify and fetch resources from networked systems. e.g. www. Sharing of resources via unique identifiers. No need to check for a page postback. Foll. code is not supported in REST approach: btnSave_Cick() { Response.Redirect("~/MyPage.aspx"); }
16. ASP.NET MVC Framework In MVC framework, URL routing is used. URLs are used based on the settings in a config file. e.g.: http://localhost/customer/list/ instead of traditional URL like: http://localhost/CustomerList.aspx ASPX pages are kind of view engine, nothing else. ASP.NET MVC framework is not a replacement or upgrade of web forms, but merely another way of programming.
17.
18. MVC Framework model:CustomerList.aspx processed by ASP.NET runtime and HTML returned to IIS Client browser requests URL http://myapp/CustomerList.aspx IIS Client browser requests URL http://myapp/Customer/List ASP.NET runtime IIS Controller Class Model Class View (ASPX)
19. MVC 2.0 Enhancements Includes ASP.NET MVC 2 framework. Strongly Typed Html Helpers: view model level error instead of all validation Errors ASP.NET MVC 1 : <%= Html.TextBox(“ClassId”, Model.ClassId) %> ASP.NET MVC 2 : <%= Html.TextBoxFor(model => model.ClassId) %> Model Validation: Validation logic is always enforced on the server, and if needed can be done on client via JavaScript.
20. MVC 2.0 Framework Enhancements Areas Support:Group controllers and views into sections. Data-Annotation Attribute Validation Support: Enable to perform validation by adding one or more attributes. (Add References: Microsoft.Web.Mvc.DataAnnotations.dll and System.ComponentModel.DataAnnotations.dll assemblies. E.g.:
21. MVC 2.0 Framework Enhancements using System.ComponentModel; Using System.ComponentModel.DataAnnotations; namespace MvcApplication1.Models {public class Product {public int Id { get; set; } [Required] [StringLength(10)] public string Name { get; set; } [DisplayName("Price")] [Required] [RegularExpression(@"^?+(({2}))?$")] public decimal UnitPrice { get; set; } }}