This example has for file

WebForm1.aspx, WebForm1.js, WebForm1.aspx.vb

I recommend that you use a seperate JavaScript file for the Ajax and
other JavaScripts because of the following:
 -- Faster download to the browser, the browser will cache the file
 -- You can obfusicate the file
 -- You can debug the file.

@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@~@
WebForm1.aspx
@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@~@


<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="WebForm1.aspx.vb" Inherits="AjaxVB.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
        <HEAD>
                <title>WebForm1</title>
                <meta name="GENERATOR" content="Microsoft Visual Studio .NET 
7.1">
                <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
                <meta name="vs_defaultClientScript" content="JavaScript">
                <meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5";>
                <script src="WebForm1.js" language="javascript"
type="text/javascript"></script>
        </HEAD>
        <BODY>
                <form id="Form1" method="post" runat="server">
                        <button onclick="GetServerTime_Async();" 
type="button">GetServerTime
Async</button>
                        &nbsp; <button onclick="GetServerTime_Sync();"
type="button">GetServerTime Sync </button>
                        &nbsp;<br>
                        <span id="spanTime"></span>
                </form>
        </BODY>
</HTML>

@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@~@
Webform1.aspx.vb
@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@~@

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        ' Note the namespace of the application is AjaxVB
        AjaxPro.Utility.RegisterTypeForAjax(GetType(AjaxVB.WebForm1))
    End Sub

    <AjaxPro.AjaxMethod()> _
    Public Function GetServerTime() As String
        Return DateTime.Now.ToString()
    End Function

@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@~@
Webform1.js
@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@~@
function GetServerTime_Sync()
{
        document.getElementById("spanTime").innerHTML =
AjaxVB.WebForm1.GetServerTime().value;
}

function GetServerTime_Async()
{
        // Use asynchronize call
        document.getElementById("spanTime").innerHTML = 'Getting time';
        // NOTE Syntax <namespace>.<classname>.method (params,
callbackfunction)
        AjaxVB.WebForm1.GetServerTime(GetServerTime_Async_Callback);
}

function GetServerTime_Async_Callback(response)
{

        document.getElementById("spanTime").innerHTML = response.value;

}

Joseph Guadagno
http://www.josephguadagno.net


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Ajax.NET Professional" group.

To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]

For more options, visit this group at http://groups.google.com/group/ajaxpro

The latest downloads of Ajax.NET Professional can be found at 
http://www.ajaxpro.info
-~----------~----~----~----~------~----~------~--~---

Reply via email to