在asp.net中使用Ajax遇到的问题,谢谢高手解决,在线等
View视图中的代码为
<%@ 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 language="javascript" type="text/javascript">
// <!CDATA[
function comit_onclick()
{
var name=document.getElementById("tb1").value;
_Default.SetTb(callback);
}
function callback(res)
{
document.getElementById("tb").value=res.value;
}
// ]]>
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="tb1" runat="server"></asp:TextBox><br />
<input id="comit" type="button" value="Ok" onclick="return comit_onclick()" />
<br /><asp:TextBox ID="tb" runat="server"></asp:TextBox>
</div>
</form>
</body>
</html>
.cs文件中的代码为
protected void Page_Load(object sender, EventArgs e)
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(_Default));
}
[AjaxPro.AjaxMethod]
public string SetTb(string name)
{
return name;
}
但是运行了以后就提示我
行:15
字符:2
错误:'_Default'未定义
代码:0
url:http://localhost:1868/website5/default.aspx
请问这是为什么啊??
希望大家帮忙解决一下,谢谢