Download presentation
Presentation is loading. Please wait.
Published byJoseph Daley Modified over 11 years ago
1
Module 1: Creating Responsive Pages with Ajax Creating Partial-Page Updates by Using AJAX Scripting Actions on the Web Client
2
Lesson: Creating Partial-Page Updates by Using AJAX What are Partial-Page Updates? Discussion: Applications for Partial-Page Updates The ASP.NET AJAX Controls Implementing Partial-Page Updates Demonstration: Partial-Page Updates The ASP.NET AJAX Control Toolkit
3
What are Partial-Page Updates? Initial download is the whole page Parts of the page can refresh while the rest of the page remains static
4
Discussion: Applications for Partial-Page Updates Scenario: A small page that displays brief details about a single product. Scenario: A page that displays brief details about many products. Scenario: A page that displays brief details about share prices.
5
The ASP.NET AJAX Controls ScriptManager Manages script libraries and script files, partial-page rendering, and other functions. UpdatePanel Enables sections of a page to be partially rendered without a page postback. UpdateProgress Provides visual feedback on the browser when the contents on UpdatePanel controls refresh. Timer Performs partial-page updates at defined intervals.
6
Creating the ScriptManager Control: Implementing Partial-Page Updates <asp:ScriptManager ID="ScriptManager1" runat="server" /> <asp:ScriptManager ID="ScriptManager1" runat="server" /> Creating an Update Panel and Adding Controls: <asp:GridView ID=GridView1 datasourceid=MyDataSource autogeneratecolumns=true allowpaging=false runat=server> <asp:Button ID=UpdateButton Text=Refresh the Grid runat=server /> <asp:GridView ID=GridView1 datasourceid=MyDataSource autogeneratecolumns=true allowpaging=false runat=server> <asp:Button ID=UpdateButton Text=Refresh the Grid runat=server />
7
The ASP.NET AJAX Control Toolkit Shared source project between Microsoft and the ASP.NET AJAX community Downloadable from http://www.codeplex.com Contains a collection of templates and controls Provides an infrastructure to write reusable and extensible ASP.NET AJAX controls
8
Lesson: Scripting Actions on the Web Client Improving Responsiveness by Creating Client- Side Scripts Creating Server-Side AJAX Services Calling Services from Client-Side Scripts Best Practices for Client-Side Scripting and AJAX
9
Improving Responsiveness by Creating Client-Side Scripts
10
Creating Server-Side AJAX Services Implementing a Server-Side Service as an ASP.NET Web Service Implementing a Server-Side Service as Page Methods Formats for Service Messages
11
Calling Services From Client-Side Scripts Adding Service References and Client-Side Script: <asp:ScriptManager ID="ScriptManager1" runat="server"> <asp:ServiceReference Path=NewsWebService.asmx" /> <asp:ScriptReference Path=NewsClientScript.js" /> <asp:ScriptManager ID="ScriptManager1" runat="server"> <asp:ServiceReference Path=NewsWebService.asmx" /> <asp:ScriptReference Path=NewsClientScript.js" /> Calling a Service Function: function GetNews() AdventureWorks.NewsWebService.GetNews(Succeeded) function GetNews() AdventureWorks.NewsWebService.GetNews(Succeeded)
12
Best Practices for Client-Side Scripting and AJAX Consider using AJAX whenever a small portion of a large page must refresh. Use the UpdatePanel to enable partial page updates without custom JavaScript code. Use the UpdateProgress control to reassure users when a partial page update takes time. Register client-side scripts with the AJAX client-side library to make use of AJAX extensions to JavaScript. Use AJAX services and custom JavaScript for optimum performance. Prevent use of the GET request verb in AJAX requests for increased security.
13
Lab: Creating Responsive Pages by Using Client-Side Technologies Exercise 1: Implementing Partial-Page Updates by Using AJAX Controls Exercise 2: Accessing a Web Service by Using a Client Side Script Estimated time: 60 minutes
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.