Professional Documents
Culture Documents
Solution is Ajax
AJAX or Ajax ?
Goal is to make browser/server interaction
easy and fast.
XMLHttpRequest Object
Requires Javascript
Degrade gracefully if turned of
Fiddler
Object Orientation
Object Orientation
Can associate any arbitrary value with any arbitrary
property of the object
Can have methods, defined as functions
var point = {
X: 10,
Y: 20,
Z: 30,
add: function(p){
this.X = this.X + p.X;
this.Y = this.X + p.Y;
this.Z = this.X + p.Z;
}
}
DHTML
Dynamic HTML
Javascript modifies HTML = DHTML
Arrays
A common way to create and append strings
in javascript is to create an Array Object
Array in javascript are Zero based, and not
fixed in length, and can continue to grow
simply by appending to the end of the object
display[ display.Lenght] = Added Text;
To pull content together as one long string,
use the Array.Join(delimiter) method: ( notice
the empty string delimiter in this example).
display.Join();
backgroundColor
height
width
<div id=myDivTag></div>
<script language=javascript>
var divTag =
document.getElementById(myDivTag);
divTag.innerHTML = <h1>Hello World</h1>
divTag.style.color = Red;
</script>
Multi-Browser Support
Ajax framework
({Urls : [
{Name : Microsoft , url : http://www.Microsoft.com}
{Name : Google , url : http://www.Google.com}
{Name : MiSys , url : http://www.Misys.com}
]
})
]
})
Using JSON
eval function
Standard JavaScript deserializer
Preferable to XML
Javascript Objects
Object Signature
urls[urls.lenght] = new
nav(Microsoft,http://www.microsoft.com);
urls[urls.lenght] = new
nav(Google,http://www.google.com);
Enclosures
Enclosures
Using the ToLink method
for (x=0; x<urls.lenght; x++) {
content[content.lenght] = <li>;
content[content.lenght] = urls[x].ToLink();
content[content.lenght] = </li>;
}
Prototype
nav.prototype.ToLink = function(){
var link = new Array;
link[link.lenght] = <a href=;
link[link.lenght] = this.url;
link[link.lenght] = >;
link[link.lenght] = this.Name;
link[link.lenght] = </a>;
return link.join();
}
Enclosure or Prototypes?
Server-Side Ajax
Client-Side Ajax
Script tag
ScriptManager Property
Collections
AuthenticationService
ProfileService
RoleService
Scripts
Services
Default markup
ScriptReference Control
Load myScript.js
ServiceReference
ScriptManager in Debug
Mode
ScriptManager property
Default value is Auto
Uses debug setting in Web.config
<compilation debug=true />
Options
Auto
Debug
Inherit
Release
UpdatePanel default
behavior
UpdateMode attribute
ChildrenAsTrigger attribute
Triggers
Change Behavior
ScriptManagerProxy Control
UpdateProgress Control
Timer Control
Nesting UpdatePanels
Control Extenders
Client Controls
AlwaysVisibleControlExtend
er
Column headers
Menu or command buttons
Keep ad in views
AutoCompleteExtender
Control
FilteredTextBoxExtender
Control
ListSearchExtender Control
MaskedEditExtender Control
TextBoxWaterMarkExtender
Control
TextBoxWaterMarkExtender takes
care of the heavy lifting
PasswordStrenght Control
ToolkitScriptManager
Control
In addition to ScriptManager
properties
CombineScripts property
CombineScriptsHandlerUrl property