Microsoft ASP.NET AJAX Sample Code

Details

This simple application retrieves the server time using ASP.NET AJAX 1.0. Note that Windows 2008/IIS 7 servers do not support AJAX 1.0. This sample code will only work on IIS 6 servers.

 
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>ASP.NET AJAX 1.0 Test</title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="Button1" />
        </Triggers>
         <ContentTemplate>
             <fieldset>
                 <legend>Current server date and time</legend>
                 <%=DateTime.Now.ToString() %>
             </fieldset>
         </ContentTemplate>
    </asp:UpdatePanel>
    <br />
    <asp:Button ID="Button1" runat="server" Text="Update" /><br />
    <br />
    </form>
</body>
</html>

NOTE: The ASP.NET AJAX installer will include a sample web.config file which specifies the necessary assemblies, httpHandlers, httpModules, etc. for it to work properly. It is generally located in C:\Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025. You must incorporate this web.config into your existing web application, or create a new ASP.NET AJAX-Enabled Web Site in Visual Studio 2005.

 

  • 1 Kasutajad peavad seda kasulikuks
Kas see vastus oli kasulik?

Seotud artiklid

Microsoft ASP.NET AJAX Information

Details ASP.NET AJAX is a set of technologies to add AJAX (Asynchronous JavaScript And XML)...