• Like
AJAX Web Development Using .Net 2.0
Upcoming SlideShare
Loading in...5

AJAX Web Development Using .Net 2.0

Uploaded on


  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads


Total Views
On Slideshare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide
  • Take week of Thanksgiving off There will not be any hands on labs during class I will give out optional homework assignments each week that you may choose to do. I will take attendance by looking at the WebEx logs. I will provide many sources of additional information. Typically at the beginning of each class session I will answer questions and review the previous week’s optional homework.
  • Some familiarity and prior experience with .Net development is helpful. Focus will be hands on web development, rather than build management for example. We have 25 students with varying levels of experience performing .Net development. I am trying to gear the course towards the majority of students – somewhere in the middle. If you have never done any web development, the class may be challenging.
  • At the end of the 6 week semester we will accomplish the following. Questions and interactive Discussion are encouraged! Please visit the collaborative site on the SRA portal under EmployeeTraining SRA University Fall 2008 Collaborative sites.There are areas for homework, class material, Discussions, tasks, surveys, and other links. Please take advantage of this to post questions or discussions that you feel may be of interest to the entire class.
  • Because this is a brand new course and we have a large class, the weekly objectives may change slightly in order to meet the class’s needs.
  • The books section of the author’s website has code listing as well as hosted code. Chapter 1 code can be run on VS2005. The first time you run the code in VS2008 you may be prompted by Visual Studio if you want to convert the code to .Net Framework 3.5. You can reply ‘yes’. At any time you can change the target framework by modifying the project properties. The course text has over 1000 pages and over 30 chapters. We cannot hope to cover all material in 12 hours, but we will focus on our course objectives.
  • VS2008 Pro 90 day version available for download from msdn.microsoft.com Visual Web Developer free download from msdn.microsoft.com If you or your team has access to MSDN universal subscription of Team System subscription you have access to VS2008 Professional One other alternative is to contact Bill Scherer Jr, he may be able to get you a development copy of VS2008 Pro If you are using a full version of SQL Server, some of the virtual labs andor course text exercises will require that you modify the connection string to the data source. SQL Server Express is included with Visual Studio 2005 or VS2008 and can be installed as an option you select (custom option). For those of you working in a customer environment where you have no way of accessing VS2008, the virtual labs allow you to work on virtual machines with all the necessary software installed.
  • Web forms, introduced in VS2003, was designed to mimic the look and feel of windows forms. The projects themselves were stored in a single solution file, hosted only in IIS, and required the code to be compiled to a DLL. So, you’d have all of your code compiled into a single DLL, and you could deploy the DLL with the HTML to the site. The problem with this approach is that it’s not easy to distribute a solution over a team. Having users work on different parts of a site in the same solution, or pull the solution from source control and set it up for the first time was often difficult.
  • This model changed in VS2005 by having a website compilation model. The 2.0 Framework compile the code dynamically as it was requested, and cache those DLLs in the ASP.NET runtime folder. Because this was a loose project type, special folders like App_Code were included, and ASP.NET understood the App_ prefix and would automatically try to resolve references to class files in those directories. The advantage of this approach was that it made creating distributed projects much easier. But, there is a slight performance hit on the first request unless precompilation is done. Generally this is considered negligible. In some situations, it may mean more files to deploy, but in many cases, you’d only need to deploy the files that are changed. ASP.NET will recompile on the fly. This makes doing incremental updates much easier, and makes setting up the project on other machines easier.
  • VS2008 includes support for both project types, the older style project types being wrapped up in the ASP.NET Web App template. But by default, the VS2005 project model is the recommended approach for website development in 2008.
  • Multi-targeting support for .Net Framework versions 2.0, 3.0, 3.5 Assemblies Code Behind Model separates UI from server side code Hosting web site using File System – introduced in VS 2005 – don’t need IIS Event Handler – We can code several things to happen during the web page lifecycle. The page lifecycle is discussed on p45 of the course text Debugging – setting a breakpoint Key point p.26 remember is that ASP .Net is a server side web application framework. The .Net Framework code that we write executes on the web server not the client browser. From the perspective of ASP .Net nothing happens until a page is posted back to the server.
  • ASP .Net pages are often called web forms because they almost always contain a server side forms element. Controls can be dragged onto the design surface from the toolbox, or created programmatically in code.
  • Web server controls include not only form controls such as buttons and text boxes, but also special-purpose controls such as a calendar, menus, and a tree view control.
  • In addition to using Web server controls in your ASP.NET Web pages, you can create your own custom, reusable controls using the same techniques you use for creating ASP.NET Web pages. These controls are called user controls. A user control is a kind of composite control that works much like an ASP.NET Web page—you can add existing Web server controls and markup to a user control, and define properties and methods for the control. You can then embed them in ASP.NET Web pages, where they act as a unit.
  • HTML elements exposed to the server so you can program them. HTML server controls expose an object model that maps very closely to the HTML elements that they render. Rarely used in the book’s examples.
  • User controls are highly reusable components but are always embedded within a page. Therefore, there was no easy way to build a consistent site design look/feel until Master Pages came out. The concept of a master page is that we define a template, the basic head/body tags, include any common script references, and then define some content areas in ContentPlaceHolders. There can be many, or few of these placeholders. When we create a new ASPX page, we can tell it to inherit from the master page, so all of the “shell” code is brought in automatically. That ASPX page can then stub out those content pages as much as necessary, use user controls, etc., to complete the look and feel.
  • . If you’re working on a specific page, you can specify @Trace=True in the Page directive, or can specify for the entire site in the web.config. Page Level overrides Web.Config settings
  • Intellisense for RAD developer experience Type inference JavaScript referencing Comments in functions You can define Web service references and get intellisense support for the ‘proxy’ Debugging Nested master pages View any level of Master Pages in design View Managing CSS You can easily manage and apply styles CSS Summary view helps troubleshooting Multi-targeting Use VS 2008 IDE features independent of your .NET FX version Decouple your development experience from FX versions of your web server New data controls such as 10 Using List Controls 437 11 Using the GridView Control 481 12 Using the DetailsView and FormView Controls 563 13 Using the Repeater and DataList Controls 619 14 Using the ListView and DataPager Controls 657 Designer Split view Changes in source view instantly updates design view Split screen vertically or horizontally Nested master pages View any level of Master Pages in design View Design developer workflow Visual Studio Developer and Express Web Designers share the same design surface Managing CSS You can easily manage and apply styles CSS Summary view helps troubleshooting
  • ASP .Net section of the Microsoft Developer network website includes Webcasts, How do I videos, blogs, and forums Sra.skillport.com includes books 24x7 and courses. Search for asp .net Virtual Labs - Free – log onto a virtual server, download the lab manual and go! I have presentations available on my SRA portal site on the topics of ASP .Net Internals Asynchronous ASP .Net Programming Black Belt ASP .Net Techniques Leveraging Cryptography in ASP >net Web Sites New Features of ASP .Net and VS 2008 VS2008 Training kit The Visual Studio 2008 and .NET Framework 3.5 Training Kit includes presentations, hands-on labs, and demos. This content is designed to help you learn how to utilize the Visual Studio 2008 features and a variety of framework technologies including: LINQ, C# 3.0, Visual Basic 9, WCF, WF, WPF, ASP.NET AJAX, VSTO, CardSpace, SilverLight, Mobile and Application Lifecycle Management. www.asp.net is the official asp.net web site containing downloads, forums, videos, webcasts, info on how to get started, tutorials etc. Codeplex.com is Microsoft's open source project hosting web site. Start a new project, join an existing one, or download software created by the community.
  • This homework is optional but will allow the student to practice creating CSS styles and looking at the web designer in VS2008 Sign up for the event Download the lab manual (pdf format) Take the lab hosted on a virtual machine After completing this lab, you will learn how to: Exercise 1 – Code Setup Exercise 2 - Manage CSS style sheets on web pages Exercise 3 - Bind data using the new LINQ data source control Exercise 4 - Use the new DataPager control These sections are on LINQ and using the DataPager control. If you want to proceed with these sections locally using the VS2008 Training kit , that is fine, but the lab manual expects you to have SQL Server Express installed. If you are working on the take home lab locally on your pc (using the VS2008 Training Kit), , rather than on a virtual computer for exercises 3 and 4, you will have to modify the instructions in the lab manual if you have a full version of SQL Server installed, because the lab manual is expecting SQL Server Express to be used. I can go over the procedure next class session using a full version of sql server, rather than sqlexpress. Exercise 3 - Bind data using the LINQ data source Exercise 4 - Use the DataPager control This Virtual lab is also part of the VS2008 Training Kit


  • 1. Building Effective Web Applications with ASP .Net 3.5 Noah Subrin SRA University Fall 2008 Week 1
  • 2. Course Schedule and Format
    • Schedule
      • Every Thursday 08:30 to 10:30
      • October 23 through December 4
      • No class the week of November 24-28
    • Course Format
      • Presentations, Demos, Code Walkthroughs, White Papers, Course Text, Virtual Labs
  • 3. Target Audience
    • Prior web development experience
    • Best geared towards programmers, software engineers, web designers, technical leads, task leads and architects.
    • Class will be taught using C# which has a similar syntax to Java
  • 4. Instructor Introduction
    • Technical Lead (IRS JOC-ETD project)
    • MCSD and MCSD .Net
    • Represent SRA at developer community events in the Southeast
    • Author of five prior SRA-U courses
    • Contact info:
    • [email_address]
  • 5. Course Objectives
    • Become familiar with new features in ASP .Net 3.5
    • Build database driven apps using LINQ
    • Leverage ASP .Net AJAX on both the client and server side
    • Learn about state management and caching
    • Secure your ASP .Net websites
    • Create an end to end web app
  • 6. Course Roadmap
    • Week 1 – Getting Started
    • Week 2 – Data Access, ADO .Net and LINQ
    • Week 3 – AJAX
    • Week 4 – State Management and Caching
    • Week 5 – Security
    • Week 6 – End to End app and SP1
  • 7. Course Text and Code Samples
      • ASP .Net 3.5 Unleashed ( author Stephen Walther - Sam’s Publishing)
      • Code samples available for download at
      • www.superexpert.com
      • CD that accompanies the book has both C# and VB .Net versions of the code
      • Chapter 1 is available as a free download from www.bookpool.com
      • Demo how to run book code
  • 8. Today’s Agenda – Getting Started
    • Tools We Will Use
    • ASP .Net 3.5 Overview
    • Project Setup/Configuration
    • WebForms Overview
    • Server Controls
    • User Controls
    • Master Pages
    • Debugging and Tracing
    • New Features in ASP .Net 3.5
  • 9. ASP .Net 3.5 Overview
    • ASP .Net 3.5 is a technology that allows programmers to create dynamic web sites.
    • ASP .Net can be used to create small personal web sites or Enterprise applications
    • ASP .Net is part of the .Net Framework
    • .Net Framework consists of the Framework Class Library and the Common Language Runtime
  • 10. Tools We Will Use
    • VS 2008 Professional or
    • Visual Web Developer 2008
    • SQL Server Express Edition or higher (2005 or 2008)
    • Express Edition or higher
    • Links to download these products can be found on http://msdn.microsoft.com
    • VS2008 available from MS, MSDN or Team System subscription or contact Bill Scherer Jr (SRA Enterprise Solutions Tech Director)
  • 11. Working with .Net Projects – VS2003
    • VS2003: Single solution file. Project precompiled into a single DLL, ASPX markup pages deployed.
    • Pros:
      • Compiles/debugs like other projects (WinForms, etc.)
      • Slightly more efficient.
      • Single file deployment + referenced DLLs + HTML.
    • Cons:
      • Not easy to use in team environments.
      • Often leads to monolithic DLLs for large sites.
  • 12. Working with Projects - VS2005
    • VS2005: Website Compilation Model – All files compiled on demand.
    • Pros:
      • Works better in teams.
      • Easy to deploy/test incremental updates.
    • Cons:
      • Can be difficult to upgrade from VS2003.
      • First hit incurs compilation overhead.
      • May mean more files to deploy.
  • 13. Working with Projects - VS2008
    • VS2008: Both models supported out of the box.
    File -> New -> Web Site Old style New style New style New style File -> New -> Project -> ASP.NET Web App File -> New -> Web Site
  • 14. Demo
    • Create a new website using ASP .Net 3.5 and VS2008
  • 15. Web Forms Key Points
    • ASPX pages handled by a handler that facilitate the page lifecycle and events (such as Page_Load, PreRender, and control events).
    • Uses ViewState to encoded state-specific information otherwise lost in the stateless nature of HTTP.
    • Extensive controls library to abstract functionality. Buttons, textboxes, etc.
    • Extensible.
    • Web Forms have a .aspx file extension.
  • 16. Server Controls
    • Typically compiled into a DLL.
    • Represents a small piece of functionality, like a textbox or button.
    • Responsible for handling any special rendering requirements, raising events, etc.
    Properties Event Handlers
  • 17. User Controls
    • Collections of HTML and/or Server Controls for a broader purpose – such as a login dialog box.
    • Typically part of a project and compiled with the project.
    • Can expose properties.
  • 18. HTML Controls
    • Take any HTML tag and add a runat=“server” tag.
    • This converts the HTML tag into a server-side ASP .Net control
    • Allow us to program server side events
  • 19. Master Pages
    • Same look and feel to many pages; code in one spot.
  • 20. Break
    • We will look at some other Demos after break
  • 21. ViewState (p29)
    • The HTTP Protocol is a stateless protocol
    • Web Pages use a Request/Response model
    • ViewState allows us to save the state of a server control across multiple page requests
    • Comes with performance overhead
    • Enabled by default for each control
  • 22. Demo
    • Add page level tracing to existing page
    • Examine page lifecycle
    • Examine Viewstate cost
    • Write to trace log
    • We can determine if the page is posting back by using the Page.IsPostback property
    • We can turn tracing and debugging on at the page or app level
  • 23. Dynamic Compilation (p35)
    • When we create an ASP .Net page we are creating source code for a .Net class
    • Pages are compiled and stored in a temp folder on the web server
    • Unlike classic ASP the page will not be recompiled again, unless we disable dynamic compilation
    • This allows support for thousands of simultaneous users
  • 24. Code Behind vs Single File Pages
    • In a single file ASP .Net page, a single file contains both the page code and page controls
    • A code behind has the page code in a separate file
    • Which should you use? (p45)
  • 25. New Features of VS2008
    • Javascript Intellisense/Debugging support
    • Nested Master Pages
    • Enhanced CSS Management
    • Multi-targeting support.
    • New data controls.
    • MUCH improved designer.
  • 26. Other ASP .Net Resources
    • MSDN Web site
    • Sra.skillport.com
    • MSDN Virtual Labs
    • MS Tech-ED Developer presentations on my SRA portal site
    • VS 2008 Training Kit
    • http://www.asp.net/downloads/
    • http://www.codeplex.com/aspnet
  • 27. Optional Take Home Class Exercise
    • MSDN Virtual Lab “Building web Applications with Visual Studio 2008”
    • Event ID: 1032360368
    • (msevents.microsoft.com)
    • This lab is included in the VS2008 Training Kit mentioned on previous slide so this can be done offline on your pc workstation
  • 28. Next Week
    • Q&A
    • Week 1 Review
    • Homework Review (Take home lab)
    • Chapters 16-18 (Data Access, ADO .Net, and LINQ to SQL)
  • 29. Questions ?
    • Feel free to contact me at [email_address]
    • Please use the class portal site on the SRA portal to post question or other discussions that may be of interest to the class.
    • Thank you!