aspx页面:
单击按钮事件响应 AjaxAdd()函数:function AjaxAdd()
{
Con= "Ajax send";
alert(Con);
net.test.GetReturnCode(Con, IsAjaxAdd_callback);
alert(Con+"哈哈!");
}function IsAjaxAdd_callback(res)
{
alert(res.value);
}=========
aspx.cs:
[AjaxPro.AjaxMethod]
public string GetReturnCode(string aa)
{
if (aa =="Ajax send")
{
return "receive Ajax!";
}
else
{
return "no way!";
}
}
脚本执行到“net.test.GetReturnCode(Con, IsAjaxAdd_callback);”这里的时候出错了。。怎么回事呢?
单击按钮事件响应 AjaxAdd()函数:function AjaxAdd()
{
Con= "Ajax send";
alert(Con);
net.test.GetReturnCode(Con, IsAjaxAdd_callback);
alert(Con+"哈哈!");
}function IsAjaxAdd_callback(res)
{
alert(res.value);
}=========
aspx.cs:
[AjaxPro.AjaxMethod]
public string GetReturnCode(string aa)
{
if (aa =="Ajax send")
{
return "receive Ajax!";
}
else
{
return "no way!";
}
}
脚本执行到“net.test.GetReturnCode(Con, IsAjaxAdd_callback);”这里的时候出错了。。怎么回事呢?
解决方案 »
- 请问为什么我的分页和单击表头的自定义排序都没有出来啊?
- GUI-发生一般性错误和报内存不足,谢谢
- 数据导出到Excel?
- 菜鸟问曰:Response.Cookies和HttpCookie 有区别吗?
- 小散:刚才和人争论了半小时.高手进来看~ASP.NET的疑问
- IIs解析不了aspx文件 Asp.net2005
- asp.net2.0的数据绑定,无法将类型“string”隐式转换为“bool” 帮我看看是什么问题
- 超简单问题,如何给datalist中的label赋值?
- 急啊!那位达人帮帮啊,鄙人才学C#3天,老板让做个小东西!看看啊,在线等啊!
- 谁知道ajax方面的网站
- asp:FileUpload 控件
- 新手请教:继承母版的页面如何调用javascript函数。
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
Ajax.Utility.RegisterTypeForAjax(typeof(test));
}
}
因为我在“net.test.GetReturnCode(Con, IsAjaxAdd_callback);”前后都做了alert判断执行进度。在后台的public string GetReturnCode(string aa)里面做了断点,但net.test.GetReturnCode(Con, IsAjaxAdd_callback);还未执行到断点就报error page了
所以估计是net.test.GetReturnCode(Con, IsAjaxAdd_callback);写错了还是什么的
{
Ajax.Utility.RegisterTypeForAjax(typeof(test));
if(!IsPostBack)
{
//......
}
}
问下:
<%@ Page language="c#" Inherits="net.test" %>
是这样写的吗
test.GetReturnCode(Con).value;
后台的
namespace net
{
public class test : System.Web.UI.Page
{
....前台:
<%@ Page language="c#" Codebehind="net.aspx.cs" AutoEventWireup="false" Inherits="net.test" %>
test.GetReturnCode(Con).value;
怎么得到值?
我试了,但似乎程序没去到后台执行。
<add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax"/>
</httpHandlers>吗
function getInfo()
{
WebEmail.WebForm2.GetMsg(GetMsg_callback);
}
function GetMsg_callback(response)
{
var det= response.value;
if(det!=null && det.Tables!=null && typeof(det)=="object")
{
var dt="您有"+det.Tables[0].Rows.length + "封消息";
var msg=det.Tables[0].Rows[0].email_text;
我也是这样写的...貌似一点错都没有
sapx.cs:using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;namespace fortest
{
/// <summary>
/// WebForm1 的摘要说明。
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
AjaxPro.Utility.RegisterTypeForAjax(typeof(WebForm1));
} [AjaxPro.AjaxMethod]
public string GetReturnCode(string Con)
{
// string Con;
// Con ="Ajax send";
if (Con =="Ajax send")
{
return "receive Ajax!";
}
else
{
return "no way!";
}
} #region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load); }
#endregion
}
}=======================
aspx:<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="fortest.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="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script language=jscript>
var Con;
function AjaxAdd()
{
Con= "Ajax send";
alert(Con);
WebForm1.GetReturnCode("Ajax",IsAjaxAdd_callback);
//WebForm1.GetReturnCode(Con).value;
alert(Con+"哈哈!");
} function IsAjaxAdd_callback(response)
{
var aa = response.value;
alert(aa);
} </script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<INPUT style="Z-INDEX: 101; LEFT: 264px; POSITION: absolute; TOP: 112px" type="button"
value="Button" onclick="AjaxAdd();">
</form>
</body>
</HTML>============
web.config <system.web>
<httpHandlers>
<add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro"/>
</httpHandlers> <!-- 动态调试编译
设置 compilation debug="true" 以启用 ASPX 调试。否则,将此值设置为
false 将提高此应用程序的运行时性能。
设置 compilation debug="true" 以将调试符号(.pdb 信息)
插入到编译页中。因为这将创建执行起来
较慢的大文件,所以应该只在调试时将此值设置为 true,而在所有其他时候都设置为
false。有关更多信息,请参考有关
调试 ASP.NET 文件的文档。
-->