Asp Net Aj

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 5

Resources

Home page  http://ajax.asp.net/


Complete Documentation  http://ajax.asp.net/documentation/default.aspx?tabid=47
How to Videos  http://www.asp.net/learn/videos/default.aspx?tabid=63#ajax
Ajax Control toolkit  Link

ScriptManager Class
<asp:ScriptManager ID="ScriptManager1" runat="server" />

The ScriptManager control is central to Microsoft ASP.NET 2.0 AJAX Extensions. The
control manages all ASP.NET AJAX resources on a page.

The ability of an ASP.NET page to support partial-page rendering is controlled by the


following factors:

• The ScriptManager control's EnablePartialRendering property must be true (the


default value).
• There must be at least one UpdatePanel control on the page.
• The SupportsPartialRendering property must be true (the default value). If the
SupportsPartialRendering property is not set explicitly, its value is based on
browser capabilities.

UpdatePanel
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="btnSave" runat="server" Text="Save"/>
</ContentTemplate>
</asp:UpdatePanel>

UpdatePanel controls are a central part of Microsoft ASP.NET AJAX. They are used with
the ScriptManager control to enable partial-page rendering.

When partial-page rendering is enabled, a control can perform a postback that updates the
whole page or an asynchronous postback that updates the content of one or more
UpdatePanel controls.
There is a property Updatemode – that will control when an UpdatePanel need to be
updated. The values can be always or conditional.

Any new postbacks that are initiated while another postback is executing are canceled.

UPdateProgress
<asp:UpdateProgress ID="UpdateProgress2"
AssociatedUpdatePanelID="UpdatePanel2" runat="server">
<ProgressTemplate>
UpdatePanel2 updating...
</ProgressTemplate>
</asp:UpdateProgress>

The UpdateProgress control provides status information about partial-page updates in


UpdatePanel controls.

The UpdateProgress control helps you design a more intuitive UI when a Web page
contains one or more UpdatePanel controls for partial-page rendering. If a partial-page
update is slow, you can use the UpdateProgress control to provide visual feedback about
the status of the update.

Timer Control
<asp:UpdatePanel runat="server" id="UpdatePanel1"
UpdateMode="Conditional">
<contenttemplate>
<asp:Timer id="Timer1" runat="server" Interval="120000"
OnTick="Timer1_Tick" />
</contenttemplate>
</asp:UpdatePanel>
The Timer control performs postbacks at defined intervals. If you use the Timer control
with an UpdatePanel control, you can enable partial-page updates at a defined interval.
You can also use the Timer control to post the whole page.

Webservices
The Microsoft ASP.NET AJAX asynchronous communication layer enables a browser to
call Web service methods on the server by using ECMAScript (JavaScript). It exposes
APIs that JavaScript functions can use in any browser to call Web service methods on the
server.

<asp:ScriptManager runat="server" ID="scriptManager">


<Services>
<asp:ServiceReference path="ServerTime.asmx" />
</Services>
</asp:ScriptManager>
<input id="EchoButton" type="button"
value="GetTime" onclick="GetServerTime()" />
<script type="text/javascript">
// This function calls the Web Service method.
function GetServerTime()
{
Samples.AspNet.ServerTime.GetServerTime(OnSucceeded);
}

// This is the callback function that


// processes the Web Service return value.
function OnSucceeded(result)
{
var RsltElem = document.getElementById("Results");
RsltElem.innerHTML = result;
}
</script>

C# Code
<%@ WebService Language="C#" Class="Samples.AspNet.ServerTime" %>
using System.Web.Script.Services;

namespace Samples.AspNet
{

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class ServerTime : System.Web.Services.WebService
{

[WebMethod]
public string GetServerTime()
{
return String.Format("The server time is {0}.",
DateTime.Now);

ASP.NET AJAX Control Toolkit

The ASP.NET AJAX Control Toolkit provides a set of sample controls and extenders that
makes it a snap to spice up your web site with rich functionality.

Accordion
AlwaysVisibleControl
Animation
AutoComplete
Calendar
CascadingDropDown
CollapsiblePanel
ConfirmButton
DragPanel
DropDown
DropShadow
DynamicPopulate
FilteredTextBox
HoverMenu
ListSearch (New!)
MaskedEdit
ModalPopup
MutuallyExclusiveCheckBox
NoBot
NumericUpDown
PagingBulletedList
PasswordStrength
PopupControl
Rating
ReorderList
ResizableControl
RoundedCorners
Slider
SlideShow (New!)
Tabs
TextBoxWatermark
ToggleButton
UpdatePanelAnimation
ValidatorCallout

You might also like