New Features of ASP.NET 4.0
-
Upload
buu-nguyen -
Category
Technology
-
view
13.636 -
download
2
description
Transcript of New Features of ASP.NET 4.0
![Page 1: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/1.jpg)
New Features of ASP.NET 4.0
Buu Nguyen, MVP (ASP.NET)www.buunguyen.net/[email protected]
Microsoft Confidential 1
![Page 2: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/2.jpg)
Agenda
− ASP.NET Web Forms 4.0− ASP.NET AJAX 4.0− ASP.NET MVC 2.0− ASP.NET Dynamic Data
![Page 3: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/3.jpg)
ASP.NET Web Forms 4.0
![Page 4: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/4.jpg)
Web Forms 4.0
−SEO Improvements− Clean HTML− Chart Control
![Page 5: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/5.jpg)
Meta Tags
− Available in Page directive & Page object
set
out
![Page 6: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/6.jpg)
Routing
− Tired of ugly URLs yet?
− Routing to rescue
http://server/songs.aspx?genre=rockhttp://server/albums.aspx?year=2010&month=4&day=12
http://server/songs/rockhttp://server/albums/2010/4/12
![Page 7: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/7.jpg)
Routing
define
use
link
![Page 8: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/8.jpg)
Meta Tags & Routing Demo
![Page 9: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/9.jpg)
Web Forms 4.0
− SEO Improvements
−Clean HTML− Chart Control
![Page 10: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/10.jpg)
Microsoft Confidential
10
Client IDs before 4.0
Not so CSS-friendly and JS-friendly!!!
![Page 11: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/11.jpg)
Client IDs in ASP.NET 4.0
− ClientIDMode gives developers control− Can be specified at different levels
− machine.config and web.config
− Page
− Control
![Page 12: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/12.jpg)
ClientIDMode
ClientIDMode Description
AutoID As in earlier versions of ASP.NET
Static Reserve the exact ID – duplication possibility
Predictable Less verbose and still uniqueDefault for pages
Inherit Inherit from parent naming containerDefault for controls
![Page 13: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/13.jpg)
Client IDs Demo
![Page 14: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/14.jpg)
Semantically Correct Markup
− Rendering version
− Menu control generates <ul>, <li>− CheckBoxList’s and RadioButtonList’s
RepeatLayout now has 4 values− Table (old)− Flow (old)− OrderedList (new)− UnorderedList (new)
− Many other small improvements
![Page 15: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/15.jpg)
Web Forms 4.0
− SEO Improvements− Clean HTML
−Chart Control
![Page 16: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/16.jpg)
Chart Control
− 35 chart types− 3-D support− Ajax support− Data binding− Statistical formulae− Highly customizability− Appearance & data serialization
![Page 17: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/17.jpg)
Simple Static Chart
![Page 18: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/18.jpg)
Dynamically Populated Chart
![Page 19: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/19.jpg)
Chart Control Demo
![Page 20: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/20.jpg)
ASP.NET AJAX 4.0
![Page 21: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/21.jpg)
The ASP.NET AJAX Family
ASP.NET Ajax Library
Server-side ASP.NET AJAX
Ajax Minifier
Microsoft AJAX CDN
![Page 22: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/22.jpg)
Microsoft Confidential
22
ASP.NET Ajax Library
− JavaScript library− Server-side platform agnostic− Include Ajax Control Toolkit (with client-side
support)− Tight integration with the “adopted” jQuery− Support client-side template with DataView− Provide script loader− Support invoking web services− Work seamlessly with ASP.NET services
− Released separately from ASP.NET and VS.NET− Latest version: 0911 beta− http://ajax.codeplex.com
![Page 23: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/23.jpg)
Microsoft Confidential
23
Using Client Controls
− All ACT controls now available at client-side− Also known as “Client Controls”
− Also exposed as jQuery’s plugins
![Page 24: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/24.jpg)
Microsoft Confidential
24
Script Loader
− Manage scripts & dependencies− Detect script duplication− Load scripts in parallel− Enable lazy script loading
![Page 25: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/25.jpg)
Client Controls & Script Loader Demo
![Page 26: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/26.jpg)
Microsoft Confidential
26
DataView
− A JavaScript component allowing JSON data to be bound to an HTML template
− Support 2-way binding, master-detail, and conditional rendering
− Can retrieve data from local or services (e.g. ASMX, WCF, and WCF Data Services etc.)
![Page 27: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/27.jpg)
DataView Demo
![Page 28: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/28.jpg)
ASP.NET MVC 2.0
![Page 29: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/29.jpg)
Technology Stack
ASP.NET Web Forms
ASP.NET MVC
ASP.NET Framework(Configuration, Security, Membership, Roles, Profiles, Routing,
Caching, Session, Application State, Cookie, .aspx/.ascx/.asax/.master files etc.
.NET Framework
![Page 30: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/30.jpg)
MVC 2.0
− Separation of Concerns− Model-based Validation− Model Rendering− Scalability
![Page 31: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/31.jpg)
Microsoft Confidential
31
Areas
− Allow an MVC app to have multiple “areas”
− Like sub-projects although sharing 1 app
− Each area defines its routes
![Page 32: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/32.jpg)
Microsoft Confidential
32
Partial Action
− Render partial might cause coupling except for no-model partial view
− Partial action to rescue: invoke action which renders UI
![Page 33: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/33.jpg)
MVC 2.0
− Separation of Concerns
− Model-based Validation− Model Rendering− Scalability
![Page 34: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/34.jpg)
Model Validation
− Model validation in MVC 1.0 is ad-hoc− xVal (http://xval.codeplex.com)− ASP.NET MVC Validation Library (
http://aspmvcvalidation.codeplex.com/)
− ASP.NET MVC 2.0 solves this nicely− Client-side and server-side validation− Provider for Data Annotations on server-
side− Adapters jQuery and MS AJAX on client-
side
![Page 35: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/35.jpg)
Applying Validation
Action Method
Model
View
![Page 36: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/36.jpg)
Model Validation Demo
![Page 37: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/37.jpg)
MVC 2.0
− Separation of Concerns− Model-based Validation
− Model Rendering− Scalability
![Page 38: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/38.jpg)
Strongly-Typed Helpers
1.0 Way
2.0 Way
![Page 39: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/39.jpg)
Model Templates
− ASP.NET can render model based metadata provided by developers− Built-in templates for data types− Built-in provider for Data Annotations
− Data Annotations attributes− DisplayName, HiddenInput, DataType,
ReadOnly, ScaffoldColumn, DisplayFormat, and UIHint
![Page 40: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/40.jpg)
Helper Methods
Display
Editor
![Page 41: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/41.jpg)
Model Templates Demo
![Page 42: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/42.jpg)
Custom Templates
− MVC is shipped with built-in templates− Can override templates easily
![Page 43: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/43.jpg)
Custom Templates Demo
![Page 44: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/44.jpg)
MVC 2.0
− Separation of Concerns− Model-based Validation− Model Rendering
− Scalability
![Page 45: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/45.jpg)
Asynchronous Controller
− No blocking-thread during IO/network-bound operation => improved throughput
Source: http://msdn.microsoft.com/en-us/library/ee728598%28VS.100%29.aspx
![Page 46: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/46.jpg)
Asynchronous Controller Demo
![Page 47: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/47.jpg)
Dynamic Data
![Page 48: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/48.jpg)
Overview
− Built-in page, entity, field and filter templates
− Easy to customize or add new templates
− Declarative validation and rendering
− Integrated with ASP.NET Web Forms and MVC applications
![Page 49: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/49.jpg)
Dynamic Data Demo
![Page 50: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/50.jpg)
References
50
![Page 51: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/51.jpg)
ASP.NET Web Forms 4.0− URL Routing
− http://weblogs.asp.net/scottgu/archive/2009/10/13/url-routing-with-asp-net-4-web-forms-vs-2010-and-net-4-0-series.aspx
− Client IDs− http://weblogs.asp.net/scottgu/archive/2010/03/30/cleaner
-html-markup-with-asp-net-4-web-forms-client-ids-vs-2010-and-net-4-0-series.aspx
− Chart Control − http://www.4guysfromrolla.com/articles/072209-1.aspx
− SEO Improvements− http://weblogs.asp.net/scottgu/archive/2010/01/05/asp-net
-4-seo-improvements-vs-2010-and-net-4-0-series.aspx
![Page 52: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/52.jpg)
ASP.NET AJAX 4.0− Libraries & source code for Ajax Library
− http://ajax.codeplex.com− Tutorials & sample apps for Ajax Library
− http://www.asp.net/ajaxlibrary− Microsoft Ajax CDN
− http://www.asp.net/ajaxLibrary/cdn.ashx− Microsoft Ajax Minifier 4.0
− http://aspnet.codeplex.com/releases/view/40584
![Page 53: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/53.jpg)
ASP.NET MVC 2.0− Model validation
− http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx
− Model Templates− http://bradwilson.typepad.com/blog/2009/10/aspnet-mvc-2
-templates-part-1-introduction.html− Strongly-typed Helpers
− http://weblogs.asp.net/scottgu/archive/2010/01/10/asp-net-mvc-2-strongly-typed-html-helpers.aspx
− Areas− http://msdn.microsoft.com/en-us/library/ee671793%28VS.
100%29.aspx− Asynchronous Controller
− http://msdn.microsoft.com/en-us/library/ee728598%28VS.100%29.aspx
![Page 54: New Features of ASP.NET 4.0](https://reader033.fdocuments.net/reader033/viewer/2022061114/54582723af795994188b5344/html5/thumbnails/54.jpg)
ASP.NET Dynamic Data− Dynamic Data Presentation Layer Customization
− http://msdn.microsoft.com/en-us/library/ee211433%28VS.100%29.aspx
− Dynamic Data Schema Customization− http://msdn.microsoft.com/en-us/library/ee225428%28v=
VS.100%29.aspx