ajax & asp.net 2

38
Talal A. Alsubaie Saudi Food and Drugs Authority IT Sector Programmer

Upload: talal-alsubaie

Post on 06-May-2015

5.859 views

Category:

Technology


1 download

DESCRIPTION

Intro to AJAX and ASP.NET installation and programming

TRANSCRIPT

Page 1: Ajax & ASP.NET 2

Talal A. AlsubaieSaudi Food and Drugs Authority

IT SectorProgrammer

Page 2: Ajax & ASP.NET 2
Page 3: Ajax & ASP.NET 2

What is AJAX?

Talal Alsubaie, AJAX & ASP.net 2.0 3

Page 4: Ajax & ASP.NET 2

What does AJAX stands for?AsynchronousJavaScriptAndXML

Talal Alsubaie, AJAX & ASP.net 2.0 4

Page 5: Ajax & ASP.NET 2

What is AJAX ?AJAX is a development technique for creating interactive

web applications.

The intent is to make web pages feel more responsive by exchanging small amounts of data with the server behind the scenes, so that the entire web page does not have to be reloaded each time the user requests a change. This is intended to increase the web page's interactivity, speed, and usability.

Talal Alsubaie, AJAX & ASP.net 2.0 5

Page 6: Ajax & ASP.NET 2

What is AJAX ? It is a technique NOT a technology.

Components: Cascading Style Sheets (CSS).

Presenting information.

Document Object Model (DOM). Dynamic display and interaction with information.

XMLHttpRequest. Retrieving data asynchronously from the web server.

JavaScript. Binding everything together.

Talal Alsubaie, AJAX & ASP.net 2.0 6

Page 7: Ajax & ASP.NET 2

How does it work?

Classic Web Model Browser interacts directly with Web Server. Each Request Causes Page Refresh. Synchronous. Refresh Looses Place on Page.

Talal Alsubaie, AJAX & ASP.net 2.0 7

Page 8: Ajax & ASP.NET 2

How does it work?

Ajax Application Model: Browser interacts with Ajax Engine. Ajax Engine communicates with Web Server Asynchronous Page manipulated by Ajax Engine (no refresh)

Talal Alsubaie, AJAX & ASP.net 2.0 8

Page 9: Ajax & ASP.NET 2

Who Uses AJAX?

Google Maps, iGoogle & Gmail

Yahoo! MyYahoo! & Yahoo!Mail (beta)

And Many Others…

Talal Alsubaie, AJAX & ASP.net 2.0 9

Page 10: Ajax & ASP.NET 2

Talal Alsubaie, AJAX & ASP.net 2.0 10

AJAX ConcernsSecurityBrowser CompatibilityAccessibilityThe Back ButtonWhat if JavaScript is Turned Off?

Page 11: Ajax & ASP.NET 2

AJAX and the Back ButtonHuge usability issue.Returning to the previous state may not be

possible when a page is updated dynamically.Difficult to bookmark on a particular page state.

Talal Alsubaie, AJAX & ASP.net 2.0 11

Page 12: Ajax & ASP.NET 2
Page 13: Ajax & ASP.NET 2

AJAX Advantages:

Increased Client Interaction Gives users more of the expected behavior of a client/server

application rather than a classic web page Performance –only a portion of the page is refreshed Less bandwidth usage.

Platform Independent (sort of) Uses the browser, but relies on JavaScript

Talal Alsubaie, AJAX & ASP.net 2.0 13

Page 14: Ajax & ASP.NET 2
Page 15: Ajax & ASP.NET 2

Installing AjaxMicrosoft first presented AJAX as a project named

“ATLAS”(beta).The official release has been presented as “ASP.net AJAX.” It only supports ASP.net 2.0.There are some tools used to perform AJAX over ASP.net 1.0

and 1.1.

Talal Alsubaie, AJAX & ASP.net 2.0 15

Page 16: Ajax & ASP.NET 2

Installing AjaxNavigate to http://www.asp.netClick on AJAX tab.

Talal Alsubaie, AJAX & ASP.net 2.0 16

Page 17: Ajax & ASP.NET 2

Installing AjaxClick on Downloads

Talal Alsubaie, AJAX & ASP.net 2.0 17

Page 18: Ajax & ASP.NET 2

Installing AjaxClick Download ASP.NET AJAX v1.0

Talal Alsubaie, AJAX & ASP.net 2.0 18

Page 19: Ajax & ASP.NET 2

Installing AjaxNow save the file to you local disk, run the

file, click next until you finish installation.Click Finish Button at the end.

Talal Alsubaie, AJAX & ASP.net 2.0 19

Page 20: Ajax & ASP.NET 2

Installing AjaxNow go to visual Studio 2005.Create a new Web Site.You can see the ASP.NET AJAX-Enabled Web Site template.

Talal Alsubaie, AJAX & ASP.net 2.0 20

Page 21: Ajax & ASP.NET 2

Installing Ajax You can see in the Web Page the

ScriptManager Component. And there is an AJAX Extensions panel in

the toolbox area.

Not that the ScriptManager must be included in every page that is using AJAX.

Talal Alsubaie, AJAX & ASP.net 2.0 21

Page 22: Ajax & ASP.NET 2
Page 23: Ajax & ASP.NET 2

Developing in AJAX Open Visual Studio.NET 2005. Select File -> New -> Website.

Talal Alsubaie, AJAX & ASP.net 2.0 23

Page 24: Ajax & ASP.NET 2

Developing in AJAX Select ASP.net AJAX-Enabled Website. Click OK after selecting a name for your website and selecting your

preferred .NET language. On the “default.aspx” page, switch to Design mode as shown in

figure below:

Talal Alsubaie, AJAX & ASP.net 2.0 24

Page 25: Ajax & ASP.NET 2

Developing in AJAX As we learned before, we must have only one ScriptManager in

each page that is using AJAX. We can put the ScriptManager in a master page and it will apply

to all of its child pages. Updates will occurs in the “Updatepanel” component. A page can have more then one “Updatepanel”.

Talal Alsubaie, AJAX & ASP.net 2.0 25

Page 26: Ajax & ASP.NET 2
Page 27: Ajax & ASP.NET 2
Page 28: Ajax & ASP.NET 2

AJAX ASP.net Control ToolkitThe ASP.NET AJAX Control Toolkit is a shared-source

community project consisting of samples and components that make it easier to work with AJAX-enabled controls and extenders.

The Control Toolkit provides both ready-to-run samples and a powerful SDK to simplify creating custom ASP.NET AJAX controls and extenders.

Make sure you install ASP.NET AJAX 1.0 first!

Talal Alsubaie, AJAX & ASP.net 2.0 28

Page 29: Ajax & ASP.NET 2
Page 30: Ajax & ASP.NET 2

Installing AJAX ASP.net Control Toolkit

Talal Alsubaie, AJAX & ASP.net 2.0 30

Navigate to http://www.asp.netClick on AJAX tab.

Talal Alsubaie, AJAX & ASP.net 2.0 30

Page 31: Ajax & ASP.NET 2

Installing AJAX ASP.net Control ToolkitClick on Downloads

Talal Alsubaie, AJAX & ASP.net 2.0 31

Page 32: Ajax & ASP.NET 2

Installing AJAX ASP.net Control ToolkitClick “Download the Control Toolkit.”

Talal Alsubaie, AJAX & ASP.net 2.0 32

Page 33: Ajax & ASP.NET 2

Installing AJAX ASP.net Control Toolkit It will take you to the CodePlex site, that is Microsoft open

source tools.Click on download with no source code.

Click on the I Agree Button.

Talal Alsubaie, AJAX & ASP.net 2.0 33

Page 34: Ajax & ASP.NET 2

Installing AJAX ASP.net Control ToolkitDownload the “AjaxControlToolkit-NoSource.zip” file.Unzip the file to this location:

“C:\Program Files\Microsoft ASP.NET\”

Open Visual Studio.net 2005, Create a new AJAX-Enabled Website.

Under the “AJAX Extensions” tab right click and select Add tab, and enter it name as “AJAX Toolkit”.

Right click the “AJAX Toolkit” tab and select “Choose Items…”

Under the “.NET Framework Component” click “Brows…”.Select the file “AjaxControlToolkit.dll” located in: “C:\Program Files\Microsoft ASP.NET\AjaxControlToolkit-NoSource\SampleWebSite\Bin”

Click OK.

Talal Alsubaie, AJAX & ASP.net 2.0 34

Page 35: Ajax & ASP.NET 2

Installing AJAX ASP.net Control ToolkitYou can see that there are new controls in the “AJAX

Toolkit” tab.You can find more information about AJAX Toolkit at: http://ajax.asp.net/downloads/

Talal Alsubaie, AJAX & ASP.net 2.0 35

Page 36: Ajax & ASP.NET 2
Page 37: Ajax & ASP.NET 2
Page 38: Ajax & ASP.NET 2