Ajax 问题,请大家帮一下.

hisense 2009-05-30 11:10:01
1.修改groupcontribution的主键,改为groupcode,deptcode,mon,
2.修改staff_info,加字段skill,groupCOde:
alter table staff_info alter column skill varchar(50);
alter table staff_info alter column skill varchar(50);
3.group_info增加ischeck字段,并先改为1:
update group_info set ischeck = 1
4.把staff_info表中的数据导入accounts_users:
insert into accounts_users (UserCode,EmployeeCode,EmployeeName,DeptCode,GroupCode,Position,IsEngage,Skill,Bak,PX)
select 'new'+ EmployeeCode,EmployeeCode,EmployeeName,DeptCode,GroupCode,Position,IsEngage,Skill,Bak,PX from staff_info

update accounts_users set Gender = 1
5.Accounts_Roles 中,RoleID 改为不自增,并为主键
6.ccounts_users表中,把员工改为6,班组长该为5,
update accounts_users set Position='5' where Position ='班组长'
update accounts_users set Position='6' where Position ='员工'
7.导数据
insert into accounts_users ([UserCode],[EmployeeCode],[EmployeeName],[Gender],[Birthday],[GroupCode],[DeptCode],
[Position],[IsMonitor],[IsEngage],[Skill],[Bak],[academic],[JobTime],[WorkTime])

select [UserCode],
convert(varchar(20),cast(convert(float,[EmployeeCode]) as decimal)),
[EmployeeName],[Gender],
convert(varchar(10),[Birthday],120),
[GroupCode],[DeptCode],
[Position],[IsMonitor],[IsEngage],[Skill],[Bak],[academic],
convert(varchar(7),[JobTime],120),
convert(varchar(7),[WorkTime],120)
from 员工信息$




















用vs2008开发ajax ,作了一个测试,编译能通过,但怎么也跑不通?源码如下:

1.类Test:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
namespace aaa
{
/// <summary>
///Apple 的摘要说明
/// </summary>
public class Test
{
public Test()
{
//
//TODO: 在此处添加构造函数逻辑
//
}

[AjaxPro.AjaxMethod]
public DateTime GetServerTime()
{
return DateTime.Now;
}
}
}

2.调用页面:
using System;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(aaa.Test));
}
}

3.客户端:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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>
<script type="text/javascript" language="javascript">
function getServerTime()
{
aaa.Test.GetServerTime(getServerTime_callback); // 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(res.value);
}
getServerTime();
</script>

</head>
<body>
<form id="form1" runat="server">
<div>

</div>
</form>
</body>
</html>

4.配置文件:

<?xml version="1.0"?>
<!--
注意: 除了手动编辑此文件以外,您还可以使用
Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的
“网站”->“Asp.Net 配置”选项。
设置和注释的完整列表在
machine.config.comments 中,该文件通常位于
\Windows\Microsoft.Net\Framework\v2.x\Config 中
-->
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<httpHandlers>
<add verb="*" path="*.ashx" type="AjaxPro.AjaxHandlerFactory,AjaxPro.2"/>
</httpHandlers>
<!--
设置 compilation debug="true" 可将调试符号插入
已编译的页面中。但由于这会
影响性能,因此只在开发过程中将此值
设置为 true。
-->
<compilation debug="true">
</compilation>
<!--
通过 <authentication> 节可以配置 ASP.NET 用来
识别进入用户的
安全身份验证模式。
-->
<authentication mode="Windows"/>
<!--
如果在执行请求的过程中出现未处理的错误,
则通过 <customErrors> 节可以配置相应的处理步骤。具体说来,
开发人员通过该节可以配置
要显示的 html 错误页
以代替错误堆栈跟踪。

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
<system.codedom>
</system.codedom>
<!--
在 Internet 信息服务 7.0 下运行 ASP.NET AJAX 需要 system.webServer
节。对早期版本的 IIS 来说则不需要此节。
-->
<system.webServer>
</system.webServer>
</configuration>

5.其他:
引用的是AjaxPro.2.dll.


运行提示: Microsoft JScript runtime error: 'aaa' is undefined;

上面的是按网上的资料作的,在vs2008中,选framework 2.0。 在Msdn 查AjaxPro.Utility.RegisterTypeForAjax,没有找到,是否现在用法已变了。



...全文
197 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
wzh307 2009-05-30
  • 打赏
  • 举报
回复
AjaxPro注册的时候,typeof(className) 里面必须是类名

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(aaa.Test));
AjaxPro.Utility.RegisterTypeForAjax(typeof(_Default));
}
}
zhxingway 2009-05-30
  • 打赏
  • 举报
回复
学习了
赤色火焰 2009-05-30
  • 打赏
  • 举报
回复
3.客户端:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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>
<script type="text/javascript" language="javascript">
function getServerTime()
{
aaa.Test.GetServerTime(getServerTime_callback); // 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(res.value);
}
getServerTime(); //把它改为widow.onload=getServerTime;
</script>

</head>
<body>
<form id="form1" runat="server">
<div>

</div>
</form>
</body>
</html>
hisense 2009-05-30
  • 打赏
  • 举报
回复
请管理员帮我修改一下,上面的一些内容不是本贴的内容.谢谢.
wuyq11 2009-05-30
  • 打赏
  • 举报
回复
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.Read)]
public DataSet GetProvince(string str)
{

}

Ajax.Utility.RegisterTypeForAjax(typeof(AjaxMethod));

62,025

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧