• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
* | Microsoft Norge ASP.NET -

* | Microsoft Norge ASP.NET -






Total Views
Views on SlideShare
Embed Views



1 Embed 1

http://www.slideshare.net 1



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

    * | Microsoft Norge ASP.NET - * | Microsoft Norge ASP.NET - Presentation Transcript

    • 29. april 2010 | Microsoft Norge
    • ASP.NET -> AJAX Jan Blomquist, MVP, MCT www.traincert.net www.cbtoffice.no
    • Agenda
    • A Better Web User Experience
      • Better user experiences make better applications
        • Higher user traffic and retention
        • Greater differentiation
        • Higher user productivity
      • Fully cross-platform, cross-browser
      • High productivity AJAX application development
      • Client script framework for easy script creation and reuse
      • End-to-end programming model for browser and server
      • Rich tool experience integrated with Visual Studio
      • Free, fully supported runtime and tools
    • Architecture Diagram Server Framework Client Framework ASP.NET Pages Web Services (ASMX or WCF) HTML markup, CSS, and Script “ Ajax” Service Proxies ASP.NET 2.0 Ajax Extensions Ajax-Enabled Server Controls App Services Bridge Web Services Bridge Microsoft Ajax Library Controls, Components Script Core Base Class Library Component Model and UI Framework Browser Compatibility ASP.NET 2.0 Application Services Page Framework, Server Controls
    • What is ASP.NET Ajax?
      • An end-to-end framework for building rich, interactive Web experiences and browser-based applications
      • ASP.NET 2.0 Ajax Extensions
        • Server controls that very simply enable AJAX in any ASP.NET application
      • Microsoft Ajax Library
        • Client script framework that works cross-browser, and back-end server
      • ASP.NET Ajax Control Toolkit
        • Rich set of server controls and client script functionality
        • Community development model
      • Key Goals
        • Simple, Yet Powerful
        • .NET-like feel to script framework
        • Reduce the need for scripting by every developer in mainline scenarios
    • Why AJAX? Looking Beyond the Hype
      • Improving site/application characteristics
        • Performance: smaller updates, requests/responses
        • End-user perception: smooth interactions; no hard breaks
        • Usability: visual notifications, new gestures, widgets
        • Improve visual appeal: animations
        • Provide additional functionality: auto-updates, background work, etc.
      • Why Ajax-ify?
        • Not just because of the hype!
        • Differentiated experiences are key to new successes with customers and meeting rising expectations
    • AJAX Video Viewer
    • Which Scenarios does ASP.NET Ajax Address?
      • Enriching ASP.NET applications
        • No scripting required
        • Declaratively enable post-back-less updates and partial rendering of portions of pages
        • Ajax-enabled controls or extenders for scenarios beyond page updates
      • Using Web services from client script
        • Some amount of scripting
        • Method-based abstraction over XMLHttp for .asmx/.svc services
        • Support for JSON, RESTful services
      • Building reusable Ajax Components
        • Requires scripting with pay for play model
        • Script framework provides more robust, and productive development model
        • Extensibility support on both server and client
    • Demo Notes Ajax via UpdatePanels
      • Simple mechanism for basic “Ajax-y” feel
      • Declarative model to specify logical parts of your page
        • No need for scripting
      • Each part can update incrementally and independently without a postback
      • Updates happen without regular post-backs
        • Browser does not refresh entire page
      • Requests are processed as regular post-backs
        • Server-side logic and model is preserved
        • Framework code determines the parts of the page that should be re-rendered
    • UpdatePanel Under the Covers
      • Client script suppresses normal form submit
        • Simulates post-back request via XMLHttpRequest
          • All form fields, including view state
        • One extra header to request partial rendering
      • Server processes a regular post-back
        • Same page lifecycle, post-back processing
        • UpdatePanels determine if they need to be updated
          • Always vs. Conditional modes
        • ScriptManager control takes over rendering
          • Only render content of UpdatePanels needing update
          • Response includes updated view state
      • Client script processes “delta” response
        • Updates rendering with new markup
        • Update hidden fields etc.
    • Demo Notes UpdatePanel Performance Guidelines
      • Post-back requests are still full post-back requests
        • Incremental approach; preserves existing app models
        • One request at a time
        • Smaller responses, but requests are same
        • Think about which user actions should cause post-backs
      • Optimize what needs to be updated and when
        • Set UpdatePanels into Conditional Mode
        • Use Triggers, or Update() method to control
    • UpdatePanel Code Snippet
      • <asp:DataList id=“videoList”> … </asp:DataList>
      • <asp:ObjectDataSource id=“photosDS” …>
      • <SelectParameters>
      • <asp:ControlParameter name=“id” ControlID=“videosList” />
      • </SelectParameters>
      • </asp:ObjectDataSource>
      • <asp:UpdatePanel runat=“server”>
      • <ContentTemplate>
      • <asp:FormView runat=“server” id=“videoView”
      • DataSourceID=“videoDS”>
      • <asp:Image runat=“server” id=“videoImage”
      • ImageUrl=“<%# Eval(“videos/P{0}.wmv”, ID) %>” />
      • </asp:FormView>
      • </ContentTemplate>
      • </asp:UpdatePanel>
    • Demo Notes Accessing Web Services
      • Applications can expose data and operations as “Web services”
        • SOAP (.asmx, .svc), RESTful (.ashx) models
      • Support for JSON-based message format and object serialization
      • XMLHttp abstractions on the client
      • Script proxies for .asmx and .svc services
        • Enables calling methods which in turn perform web requests, and marshalling of parameters and return values
    • Web Services Code Snippet
      • Server-side code for Web service (.asmx)
      • public class VideoService : WebService {
      • [WebMethod]
      • public Video GetVideoInfo(string VideoId) {
      • return VideoController.GetVideo(VideoId);
      • }
      • }
      • Client-side code (script proxy)
      • <script type=“text/javascript” src=“VideoService.asmx /js ”></script>
      • Client-side code (invoking the service)
      • <script type=“text/javascript”>
      • function onVideoButtonClick(VideoID) {
      • VideoService.GetVideoInfo (VideoID, onVideoInfoAvailable);
      • }
      • function onVideoInfoAvailable(result) {
      • var path= result.VideoPath;
      • ...
      • }
      • </script>
    • Demo Notes Partial Rendering vs. Web Services
      • Two models for updating UI incrementally
      • Partial rendering – when you need page state, controls etc. in server-side logic
        • Pros: Simple to incorporate, use control properties, page state
        • Cons: Full-postback, one request at a time
      • Web Services – when your server-side logic is stateless
        • Pros: Light-weight, multiple requests in parallel
        • Cons: Need to write a bit of client script to extract data from UI, and package as parameters to call web service
      • Both are useful tools
      • ASP.NET Ajax provides both models
        • UpdatePanel
        • .asmx/.svc programming model; client script proxies provide higher level of abstraction over XMLHttpRequest
    • Demo Notes Scripting
      • Improvements to raw scripting
        • OOP simulation: namespaces, classes, interfaces, enums, delegates
        • BCL extensions: Array, String, etc.
        • BCL additions: StringBuilder, Debug, etc.
      • UI Framework
        • Behaviors and Controls on the client to attach functionality to DOM elements
        • Unobtrusive script model keeps content and behavior separate
    • Resources
      • ASP.NET AJAX Website
        • Downloads, videos, tutorials, and forums
        • http://ajax.asp.net
    • ASP.NET AJAX Release Roadmap Beyond
      • New features previewed in ASP.NET AJAX Futures CTP
      • Visual Studio and .NET Framework “Orcas”
        • ASP.NET AJAX will be rolled into .NET Framework
        • Better tools for script authoring and debugging
        • Better designer support for ASP.NET AJAX server controls
        • Richer server controls
        • Fully localized versions of runtime, tools, and documentation (V1.0 already supports localized applications)
    • Til slutt…
      • Hjelp oss å bli bedre
        • Fyll ut evalueringen som kommer på e-post
        • Gi direkte råd til Microsoft-representanter
      • Hold deg oppdatert
        • www.microsoft.no/informasjon
        • Besøk oss på www.microsoft.no/msdn eller www.microsoft.no/technet
      29. april 2010 | Microsoft Norge