asp.net AjaxPro.2.dll的问题
网上有个用Ajaxpro.2.dll的例子我怎么做都做不成功。Js报错说ajaxpro.GetServerTime对象不支持此方法或者属性代码如下:前台:<%@PageL...
网上有个用Ajaxpro.2.dll的例子 我怎么做都做不成功。Js报错说
ajaxpro.GetServerTime 对象不支持此方法或者属性 代码如下:
前台:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ajaxpro.aspx.cs" Inherits="ajaxpro" %>
<!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 runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<script type="text/javascript" defer="defer">
// loading效果
AjaxPro.onLoading = function(b)
{
var a = document.getElementById("loadinfo");
a.style.visibility = b ? "visible" : "hidden";
}
function GetTime()
{
// 调用服务端方法
//调用方法:类名.方法名 (参数为指定一个回调函数)
alert(00);
ajaxpro.GetServerTime(callback);
}
function callback(res) //回调函数,显示结果
{
alert(res.value);
}
</script>
<div id="loadinfo" style="visibility:hidden;position:absolute;left:0px;top:0px;background-color:Red;color:White;">Loading...</div>
<input id="Button1" type="button" value="Get ServerTime" onclick ="javascript:GetTime();void(0)" />
</form>
</body>
</html>
后台:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using AjaxPro;
public partial class ajaxpro : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(ajaxpro));
}
public static string GetServerTime()
{
System.Threading.Thread.Sleep(2000);
return DateTime.Now.ToString();
}
} 展开
ajaxpro.GetServerTime 对象不支持此方法或者属性 代码如下:
前台:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ajaxpro.aspx.cs" Inherits="ajaxpro" %>
<!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 runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<script type="text/javascript" defer="defer">
// loading效果
AjaxPro.onLoading = function(b)
{
var a = document.getElementById("loadinfo");
a.style.visibility = b ? "visible" : "hidden";
}
function GetTime()
{
// 调用服务端方法
//调用方法:类名.方法名 (参数为指定一个回调函数)
alert(00);
ajaxpro.GetServerTime(callback);
}
function callback(res) //回调函数,显示结果
{
alert(res.value);
}
</script>
<div id="loadinfo" style="visibility:hidden;position:absolute;left:0px;top:0px;background-color:Red;color:White;">Loading...</div>
<input id="Button1" type="button" value="Get ServerTime" onclick ="javascript:GetTime();void(0)" />
</form>
</body>
</html>
后台:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using AjaxPro;
public partial class ajaxpro : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(ajaxpro));
}
public static string GetServerTime()
{
System.Threading.Thread.Sleep(2000);
return DateTime.Now.ToString();
}
} 展开
若以下回答无法解决问题,邀请你更新回答
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询