test.aspx.cs:
using System;
namespace MyDemo
{
public partial class test : System.Web.UI.Page
{
void Page_Load(object sender, EventArgs e)
{
Response.Write("Page_load");
AjaxPro.Utility.RegisterTypeForAjax(typeof(MyDemo.test));
//test myTest = new test();
//Response.Write(test.GetServerTime());
}
[AjaxPro.AjaxMethod]
public static DateTime GetServerTime()
{
return DateTime.Now;
}
}
}
-------------------------------------------------------------------
test.aspx:
<%@ Page Language="c#" CodeFile="test.aspx.cs" Inherits="MyDemo.test"
%>
<%@ import Namespace="MyDemo" %>
<html>
<head>
<title>Untitled Page</title>
<script type="text/javascript">
function getServerTime()
{
alert("1");
MyDemo.test.GetServerTime(); // asynchronous call
}
// This method will be called after the method has been executed
// and the result has been sent to the client.
function getServerTime_callback(res)
{
alert("Test");
alert(res.value);
}
</script>
</head>
<body>
<form></form>
<script type="text/javascript">
getServerTime();
</script>
</body>
</html>
-------------------------------------------------------------------
web.config:
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<system.web>
<httpHandlers>
<add verb="POST,GET" path="ajaxpro/*.ashx"
type="AjaxPro.AjaxHandlerFactory, AjaxPro.2"/>
</httpHandlers>
<compilation defaultLanguage="c#" debug="true">
</compilation>
<customErrors mode="Off"/>
</system.web>
</configuration>
--~--~---------~--~----~------------~-------~--~----~
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/
Don't forget to read my blog at http://weblogs.asp.net/mschwarz/
-~----------~----~----~----~------~----~------~--~---