1 / 32

Scott Hanselman Jon Galloway

Building Web Apps with ASP.NET Jump Start. Scott Hanselman Jon Galloway. Meet Scott Hanselman | @ shanselman. Principal Program Manager, Microsoft Web developer focused on Windows Azure and ASP.NET Blogging at http://hanselman.com for over a decade

emilie
Download Presentation

Scott Hanselman Jon Galloway

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Building Web Apps with ASP.NET Jump Start Scott Hanselman Jon Galloway

  2. Meet Scott Hanselman | @shanselman Principal Program Manager, Microsoft Web developer focused on Windows Azure and ASP.NET Blogging at http://hanselman.com for over a decade One of Microsoft’s Most Respected Developers Written a number of books and spoken in person to almost a half million developers worldwide http://hanselminutes.com for tech talk http://thisdeveloperslife.com on developers’ lives and loves http://ratchetandthegeek.com for pop culture and tech media

  3. Meet Jon Galloway | @jongalloway Windows Azure Technical Evangelist Focused on ASP.NET MVC http://weblogs.asp.net/jgalloway Web development on Microsoft platform since late '90s Ex-submariner; Showcase Showdown winner “Price is Right” Popular Author and Conference Speaker WroxProfessional MVC 4; MVC Music Store tutorial Virtual ASP.NET MVC Conference (mvcConf) First Web Camps World Tour in 2010 Herding Code podcast (http://herdingcode.com)

  4. Damian Edwards | @damianedwards ASP.NET Program Manager Focused on ASP.NET Core, Web Forms and SignalR http://twitter.com/damianedwards Australian trapped in Seattle Worked for an Ambulance company! Invented SignalR with David Fowler, and created WebFormsMVP Conference Speaker TechEd, BUILD, DevConnections and more! And a lovely billiards player

  5. Building Web Apps with ASP.NET Jump Start

  6. Building Web Apps with ASP.NET Jump Start • Target Audience • Experienced application developers interested in leveraging ASP.NET and Visual Studio 2012 to offer modern apps that target modern browsers • Suggested Prerequisites • At least six months of professional app dev experience • Previous Jump Starts:Developing in HTML5 with JavaScript and CSS3Developing Windows Store Apps with HTML5

  7. Join the MVA Community! Microsoft Virtual Academy Free online learning tailored for IT Pros and Developers Over 1M registered users Up-to-date, relevant training on variety of Microsoft products “Earn while you learn!” Get 50 MVA Points for this event! Visit http://aka.ms/MVA-Voucher Enter this code: ASPWebAppsJS(expires 3/8/2013)

  8. Introduction: ASP.NET Foundations and Scenarios Jon GallowayScott Hanselman

  9. Module Overview ASP.NET 4.5 Web Forms Visual Studio 2012 features for web devs Bundling & Optimization

  10. The foundation: tools & frameworks

  11. Visual Studio 2012: The editor for serious web dev HTML5 / CSS3 standards and smarts JavaScript language features Page Inspector One code editor for client and server Web Essentials extension

  12. NuGet: The smart, easy way to manage dependencies Find the latest release Install and configure in your project Handle dependencies and versions Updates with dependency checking Common list of installed packages Simplified uninstalls Streamlined deployment with Package Restore

  13. One ASP.NET: A Framework for us all Sites Services Web Forms Web Pages SignalR Single Page Apps MVC Web API ASP.NET

  14. ASP.NET and Web Tools 2012.2 Adds new project templates to Visual Studio No changes to ASP.NET runtime, instead adds NuGet packages Lightweight install (<10 minutes, no reboot) Download and information: http://asp.net/vnext

  15. Deploying ASP.NET Apps to the Cloud Windows Azure Web Sites (10 free!) Fast site creation and deployment Nothing new to learn Easy to scale

  16. The foundation: tools & frameworks

  17. Taking it further: key scenarios

  18. What’s New in ASP.NET 4.5 Jon GallowayScott Hanselman

  19. Building Web Apps with ASP.NET Jump Start

  20. Moving towards a goal - One ASP.NET Sites Services Web Forms Web Pages SignalR Single Page Apps MVC Web API ASP.NET

  21. Module Overview Web Forms: Strongly Typed Data Controls Web Forms: Model Binding Friendly URLs Page Inspector Visual Studio web editor features Web Essentials Bundling & Optimization Async everywhere! (BONUS!)

  22. Model Binding with ASP.NET Web Forms:Strongly Typed Data Controls Step 1: Set the ItemType <ul> <asp:Repeater ID="customersRepeater" runat="server" ItemType="WebFormsLab.Model.Customer"> </asp:Repeater> </ul> Step 2: Reference the properties as needed using the Item keyword <ul> <asp:Repeater ID="customersRepeater" runat="server“ ItemType="WebFormsLab.Model.Customer"> <ItemTemplate> <li> <a href="CustomerDetails.aspx?id=<%#: Item.Id %>"> <%#: Item.FirstName %> <%#: Item.LastName %> </a> </li> </ItemTemplate> </asp:Repeater> </ul>

  23. Web Forms: Model BindingGetting Data <ul> <asp:Repeater ID="customersRepeater" runat="server" ItemType="WebFormsLab.Model.Customer"SelectMethod="GetCustomers"> </asp:Repeater> </ul> Step 1: Set Select Method • public IQueryable<Customer> GetCustomers([Control]DateTime? createdSince) • { • IQueryable<Customer> query = _db.Customers; • if (createdSince.HasValue) • { • query = query.Where( • i => i.CreatedOn >= createdSince.Value); • } • return query; • } Step 2: Get method returns IEnumerable or IQueryable

  24. Web Forms: Model BindingInserting Data <asp:FormViewrunat="server" ID="customerForm" InsertMethod="InsertCustomer"UpdateMethod="UpdateCustomer" <EditItemTemplate> <asp:Labelrunat="server" Text="Name:" AssociatedControlID="Name" /> <asp:TextBoxrunat="server" ID="Name" Text="<%# BindItem.Name %>" /> <!-- etc. --> Step 1: Set Insert Method public void InsertCustomer() { var customer = new Customer(); TryUpdateModel(customer); if (ModelState.IsValid) { _db.Customers.Add(customer); SaveChanges(customer); } } Step 2: Use TryUpdateModel to validate, then save

  25. Web Forms: Friendly URLs public Album EditAlbum_GetItem([FriendlyUrlSegments]int? id) { return _db.Albums.Find(id); } /Album/Edit/1 \Album\Edit.aspx ID passed to controls Segments can be bound or accessed programmatically

  26. Web FormsModel Binding & Friendly URLs,Mobile Support demo…

  27. Bundling and Optimization Web pages have many external references: CSS, Images, JavaScript

  28. Bundling and Optimization Bundling combines CSS and JavaScript requests

  29. Bundling and Optimization Minification compresses the files before sending

  30. Visual Studio 2012 web dev features

  31. Visual Studio 2012 and Web Essentials demo

More Related