300 likes | 418 Views
Real World ASP.NET AJAX. Donald Ho imason Incorporated donald.ho@imason.com. Scott Howlett Microsoft Regional Director scott.howlett@imason.com. Where Are We?. Agenda. OurFaves.com Overview A Data-bound Scenario Architecture Data-bound Scenario & Demo Update Panel & Demo
E N D
Real World ASP.NET AJAX Donald Ho imason Incorporated donald.ho@imason.com Scott Howlett Microsoft Regional Director scott.howlett@imason.com
Agenda • OurFaves.com Overview • A Data-bound Scenario • Architecture • Data-bound Scenario & Demo • Update Panel & Demo • Update Panel+ & Demo • Other Microsoft AJAX framework Controls • Making your own web service calls • Rendering controls with a web service • Putting it all together
Agenda • OurFaves.com Overview • A Data-bound Scenario • Architecture • Data-bound Scenario & Demo • Update Panel & Demo • Update Panel+ & Demo • Other Microsoft AJAX framework Controls • Making your own web service calls • Rendering controls with a web service • Putting it all together
A Data-Bound Scenario • We want to show a list of items with associated data • Each “fave” list item contains the following: • Text • Hyperlinks • Pictures • ASP.NET postback functionality • Javascript functionality • Example: Sounds like a job suited to a customized data-bound list – the ASP.NET Repeater
Agenda • OurFaves.com Overview • A Data-bound Scenario • Architecture • Data-bound Scenario Demo • Update Panel & Demo • Update Panel+ & Demo • Other Microsoft AJAX framework Controls • Making your own web service calls • Rendering controls with a web service • Putting it all together
A Typical Data-bound ScenarioOverview of Architecture • 3-Tier Model: Presentation Tier, Business Logic Tier and Data Tier • 1 Caveat: Extra Web services layer for AJAX, which will get into later • We will only examine the Web Services and Presentation tiers Web Services Tier Database Presentation Tier Business Logic Tier
Agenda • OurFaves.com Overview • A Data-bound Scenario • Architecture • Data-bound Scenario Demo • Update Panel & Demo • Update Panel+ & Demo • Other Microsoft AJAX framework Controls • Making your own web service calls • Rendering controls with a web service • Putting it all together
Agenda • OurFaves.com Overview • A Data-bound Scenario • Architecture • Data-bound Scenario & Demo • Update Panel & Demo • Update Panel+ & Demo • Other Microsoft AJAX framework Controls • Making your own web service calls • Rendering controls with a web service • Putting it all together
Update Panel • The core control of the Microsoft Ajax Framework • Allows for a partial page refresh – meaning only the sections of the page you specify will be refreshed • How it works: Queue up the demo!
Agenda • OurFaves.com Overview • A Data-bound Scenario • Architecture • Data-bound Scenario & Demo • Update Panel & Demo • Update Panel+ & Demo • Other Microsoft AJAX framework Controls • Making your own web service calls • Rendering controls with a web service • Putting it all together
UpdatePanel ControlAdditional Features • Also allows for customizability in its behaviour and how partial postbacks are triggered • By default, postbacks within an UpdatePanel trigger a partial page refresh • Triggers outside the UpdatePanel may also fire the partial page refresh
Agenda • OurFaves.com Overview • A Data-bound Scenario • Architecture • Data-bound Scenario & Demo • Update Panel & Demo • Update Panel+ & Demo • Other Microsoft AJAX framework Controls • Making your own web service calls • Rendering controls with a web service • Putting it all together
Other ASP.NET AJAX ControlsASP.NET Futures & Toolkit • Aside from the UpdatePanel control, which is contained in the base release, there are many controls available separately from the ASP.NET Futures and ASP.NET AJAX Toolkit • These include the AutoComplete, Calendar, and HoverMenu controls • You can find these at ajax.asp.net
Agenda • OurFaves.com Overview • A Data-bound Scenario • Architecture • Data-bound Scenario & Demo • Update Panel & Demo • Update Panel+ & Demo • Other Microsoft AJAX framework Controls • Making your own web service calls • Rendering controls with a web service • Putting it all together
Making Your Own Web Service Calls • In addition to the controls available out of the box, there is the capability to build your own AJAX functionality • This is aided greatly by the AJAX framework, specifically the ScriptManager control, which enables you to call strongly-typed Web services from JavaScript • This means there is no need to write your own code to handle the Web service call, it has nearly all been done for you
Making Your Own Web Service CallsWhy Make Your Own Calls? • Though the UpdatePanel and other controls, ASP.NET AJAX does offer a powerful way to make AJAX calls there are two main reasons to make your own calls: • There is some inherent performance overhead when using an UpdatePanel control as compared with a traditional AJAX call • Performance hit due to data passed in a normal ASP.NET postback such as viewstate is also passed in a partial page postback • Sometimes, the built-in controls do not have required functionality
Agenda • OurFaves.com Overview • A Data-bound Scenario • Architecture • Data-bound Scenario & Demo • Update Panel & Demo • Update Panel+ & Demo • Other Microsoft AJAX framework Controls • Making your own web service calls • Rendering controls with a web service • Putting it all together
Controls and Web Services • Question: So how can you make a Web service call and continue to use your written controls? • Scott Guthrie made a useful post in his blog to solve this exact problem • The code described in his post renders a control during the Web service call and returns HTML for the JavaScript to bind to your presentation element • Code can be found at his blog (weblogs.asp.net/scottgu)
Agenda • OurFaves.com Overview • A Data-bound Scenario • Architecture • Data-bound Scenario & Demo • Update Panel & Demo • Update Panel+ & Demo • Other Microsoft AJAX framework Controls • Making your own web service calls • Rendering controls with a web service • Putting it all together
Your Feedback Matters! • Your evaluation form will be delivered to you via email after the event (save paper!) • The email will come from wwevents@microsoft.com • Everyone who completes an evaluation is entered to win an Xbox 360 • Feedback will be used to improve the event for next year