Professional Documents
Culture Documents
unit 6
unit 6
Click
Search
And you get this :
These days :
Introduction
• Ajax, shorthand for Asynchronous JavaScript and XML
• The first known use of the term in public was by Jesse James
Garrett in his February 2005 article Ajax: A New Approach to
Web Applications.
• This allows for a richer experience for the user, since loading
dynamic content can be done in the background, without
refreshing and redrawing the entire page.
• Google have made Ajax very popular.
ASP.NET Ajax Advantages
• When using Ajax, a web application can request only the
content that needs to be updated, thus drastically reducing
bandwidth usage and load time.
Declarative
Markup like
Asp.Net
Controls
ASP.Net Ajax Server Controls
UpdatePanel Control
Enable sections of a page to be partially rendered without a post back called as
Partial page rendering.
Clean round trips to server and flicker-free updates
Requires no knowledge of JavaScript or AJAX
A declarative model that works like ASP.NET server controls.
Can be used with Master pages, User Controls and Data Bound Controls.
Single or Multiple Update panel controls can also be used on a Web page.
Declarative
It can be created and refreshed programmatically. Markup like
Markup like
Asp.Net
Controls
ASP.Net Ajax Server Controls
UpdateProgress Control
It provides status information about partial-page updates in UpdatePanel
controls.
It Helps to prevent flashing when a partial-page update is very fast.
It helps to design a more intuitive UI when a Web page contains one
or more UpdatePanel controls.
Displays custom template-driven UI for:
-Indicating that an async update is in progress
-Canceling an async update that is in progress
Automatically displayed when update begins or "DisplayAfter" interval
elapses.
Declarative
Markup like
Asp.Net
Controls
Timer Control
The ASP.NET AJAX Timer control performs post backs at defined intervals.
Timer control allows to:
Periodically update the contents of one or more UpdatePanel controls
without refreshing the whole Web page.
Run code on the server every time that a Timer control causes a
postback.
Synchronously post the whole Web page to the Web server at defined
intervals.
Declarative
Markup like
Asp.Net
Controls
jQuery
• jQuery is an extensible open source JavaScript Library that’s
fast, lightweight , and CSS3 and cross browser compliant.
$(‘*’).css(‘font-family’,’Arial’);
2) The ID selector:
$(‘#Button1’).addClass(‘NewClassName’);
3) The Element selector:
$(‘h2’).css(‘color’,’blue’);
4) The Class selector:
Function Description
Changes the (inner) HTML of selected
$(selector).html(content)
elements
Appends content to the (inner) HTML of
$(selector).append(content)
selected elements
$(selector).after(content) Adds HTML after selected elements
jQuery Selectors
Function Description
$(selector).hide() Hide selected elements
$(selector).show() Show selected elements
<script src="http://code.jquery.com/jquery.js"></script>
<script>
$('#btnSlideToggle').click(function() {
$('#slideMe').slideToggle('fast');
});
</script>
Fade
• <div id="fadeMe"> This content will appear and disappear
when the div is faded in and out. </div>
• <input type="button" id="btnFadeOut" value="Fade Out">
• <input type="button" id="btnFadeIn" value="Fade In">
<script>
• $('#btnFadeIn').click(function() { $
('#fadeMe').fadeIn('slow'); }); $
('#btnFadeOut').click(function() { $('#fadeMe').fadeOut(); });
• </script>
Popup Boxes
• Alert Box
• Confirm Box
• Prompt Box
Alert Box
<html>
<head>
<script>
function myFunction()
{
alert("I am an alert box!");
}
</script>
</head>
<body>
</body>
</html>
Confirm Box
• var r=confirm("Press a button");
if (r==true)
{
x="You pressed OK!";
}
else
{
x="You pressed Cancel!";
}
Prompt Box
• var person=prompt("Please enter your
name","Harry Potter");
if (person!=null && person!="")
{
x="Hello " + person + "! How are you today?";
}