280 likes | 471 Views
New Features in ASP.NET 4 WebForms. Wallace B. McClure Scalable Development, Inc. http://morewally.com/ MVP, Author, INETA, ASPInsiders Twitter: @ wbm. Where Have We Been?. Static Web Pages. Display Logic Embedded in CGI. IDC/HTX. Active Server Pages. Load-n-go.
E N D
New Features in ASP.NET 4 WebForms Wallace B. McClure Scalable Development, Inc. http://morewally.com/ MVP, Author, INETA, ASPInsiders Twitter: @wbm
Where Have We Been? • Static Web Pages. • Display Logic Embedded in CGI. • IDC/HTX. • Active Server Pages. • Load-n-go. • Markup and Code intertwined. • Tools caused problems. • ASP.NET 1.0. • ASP.NET MVC. • ASP.NET Web Pages. • ASP.NET Evolution.
High Level WebForms • Introduced with ASP.NET 1.0. • Controls with advanced functionality. • Abstracted away HTML knowledge. • Separated Designers and Developers. • Events. • Advanced Tools. • ASP.NET Pillar.
WebForms & MVC & WebMatrix/Razor • All apps != Same requirements. • WebForms Positives • HTML for us. • Mature. • Control Ecosystem. • Postback. • ViewState. • WebForms Negatives • ViewState. • Postback. • Page Lifecycle. “Bad Developers write Bad Applications”
Agenda - What’s New? • Client IDs. • Routing Improvements. • ViewState. • CSS/HTML Improvements. • Charting. • Code Expressions. • Web.config changes. • Control changes. • New VS Project Template.
Client IDs • Unique IDs for client side programming. • IDs not client-side logical. • ClientIDMode • AutoID. • Static. • Predictable / ClientIDRowSuffix. • Inherit. • Set at: • Control. • Container. • Page. • Application.
ClientIDs – Data-Bound Controls • ClientIDRowSuffix. • Controls. • GridView. • ListView. • Repeater.
Higher Search Engine Results with Routing • Human Readable Urls. • Search Engine Optimization. • Introduced with ASP.NET 3.5 SP1. • Not talked about much. • Not intuitive to implement. • Enhanced in ASP.NET 4.0. • ASP.NET Membership. • Events.aspx?State=WA&City=RedmondorEvents/WA/Redmond
New Routing Features • Easier to implement. • PageRouteHandler class. • Page.RouteData. • Expressions. • Building a URL. • Getting data.
Search Engine Optimization with Meta Tags • Page.MetaKeywords. • Page.MetaDescription. • getters/setters.
Route Information in Markup • Expressions. • Building Urls. • Easily build Routes • Doesn’t depend on Route in Markup. • Retrieve Route Information. • Retrieve Route Information in Markup. • Doesn’t require code in Code behind.
ViewState Weight Loss • Mechanism to store state between http calls. • Control Events. • “__ViewState” hidden field. • Stores various types. • On by default for all controls • Can grow large. • Strategies. • Store on the Server. • Disable by default & only enable for controls that require it.
ViewStateMode • Enabled. • Disabled. • Inherit. • Strategy: • Continue to run as is. • Disable by default. • Only enable for the necessary controls.
CSS Improvements • Different HTML/CSS environment. • What is standard? • New style rendering – 4.0. • xhtml strict. • non-input controls and invalid styles. • div styling on system controls. • Menu, validation, border=“0” • Legacy rendering – 3.5.
Outer Table for Templated Controls • <table>, <tr>, <td> by default. • Unexpected tags. • .RenderOuterTable to remove the <table>
HTML Encoding • <%= “expression”%> - Not HTML Encoded. • <%= HttpUtility.HtmlEncode(“expression”)%> • New Code Expression in ASP.NET 4. • <%: “expression”%> - HTML Encoded. • Cross Site Scripting
Persisted Row Selection • DataBound Controls. • GridView. • ListView. • Page through results. • .EnablePersistedSelection.
Pictures are worth 1000 words with the Charting Control • .NET 3.5 SP1 addin. • Configurable. • .NET 4. • Chart Types. • Areas, Titles, legends, and annotations. • 3-D Support. • Log scaling. • Financial and statistical formula support. • Dates, Times, Currency.
Drilling into Data • DataPoint .Url property. • Chart’sOnClick event.PostBackValue.
What’s on the Menu? - asp:Menu • .NET 3.5 Menu. • Tables output. • How compliant? • ASP.NET 3.5 SP1 Hotfix for IE8. • .NET 4.0 Menu. • UL/LI output.
Get started with new Project Templates • Problem • How do you start? • By programmers, for programmers ( == Ugly ). • New Templates • More. • Not ugly.
Control Improvements • New agreement on HTML Standards. • Control rendering setting. • Disabled non-input controls. • System hidden fields. • ListView – Layout template not required. • CheckBoxList & RadioButtonList. • Layout – Flow / Table. • RepeatLayout – OrderedList (ol) / UnorderedList (ul) • Wizard & CreateUserWizard. • Fuller control over layout. • LayoutTempate.
Web.config goes on a Diet • Grown. • Ajax. • Routing. • IIS7. • Tools to Manage. • Minimized in .NET 4.
Data source controls • LINQ / Entity Framework. • QueryExtender. • User controls to queries. • Filter. • Range. • PropertyExpression. • CustomExpression.
AJAX Changes • Server side apis. • Control Toolkit updated. • Client side jQuery. • Content Delivery Network (CDN). • Scripts broken up for debugging.
Browser Capabilities • New browsers. • iPhone. • Blackberry. • Chrome. • New plugin provider. • Derive from HttpCapabilitiesProvider. • Register in web/machine.config. • Load on Application_Start.
Other Improvements for ASP.NET / IIS • Auto-Start Web Apps. • Permanent Redirect. • Compressed Session State. • Allowable Urls. • Valid URL characters – Custom Validation. • New Caching Assembly. • App monitoring within a domain.
Questions? • Where can I learn more? • http://asp.net /ajax. • http://asp.net/web-forms. • http://aspnetpodcast.com. • http://morewally.com.