【请教】模板页中使用ajaxpro出现的问题 页面A启用了模板也,在此页面中写了一些简单的ajaxpro的代码,浏览时提示“不支持此属性或方法”,“缺少对象”。但是在页面B中用同样的代码,却可以正常浏览,页面B没有启用模板页,有什么解决方法 吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 应该是ajaxpro需要启用什么代码吧?比如引用js文件或命名空间。。 protected void Page_Load(object sender, EventArgs e) { AjaxPro.Utility.RegisterTypeForAjax(typeof(Test),Page); } [AjaxPro.AjaxMethod] public string GetServerTimeString() { System.Threading.Thread.Sleep(2000); return DateTime.Now.ToString(); } function ajax_callback(response) { } function getServerTime() { Test.GetServerTimeString(ajax_callback); } <httpHandlers> <addverb="POST,GET"path="ajaxpro/*.ashx"type="AjaxPro.AjaxHandlerFactory, AjaxPro"/> </httpHandlers> 还是不行,我把代码贴出来,请指教<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="UI_AJAX_PAGE.aspx.cs" Inherits="UI_AJAX_PAGE" %><asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"></asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"><script type="text/javascript" language="javascript"> function comit_onclick() { UI_AJAX_PAGE.SetTb(callback1); } function callback1(res) { alert('aaaa'); } </script> <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="alert('aaaa')"/></asp:Content>using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;public partial class UI_AJAX_PAGE : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { AjaxPro.Utility.RegisterTypeForAjax(typeof(UI_AJAX_PAGE),Page); } [AjaxPro.AjaxMethod] public string SetVale(string item) { return item; }} 贴错了...用的是AjaxPro.2.dllweb.config:<add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory,AjaxPro.2"/> protected void Page_Load(object sender, EventArgs e) { AjaxPro.Utility.RegisterTypeForAjax(typeof(UI_AJAX_PAGE),Page); } [AjaxPro.AjaxMethod] public string SetValeData(string item) { return item; } function comit_onclick() { UI_AJAX_PAGE.SetValeData('aaa',callback1); } function callback1(res) { alert(res); } <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="alert('aaaa')"/>你的按钮没有触发脚本呀 高手求教 如何对数据库的数据调整排序? 类似 京东的产品筛选 功能那个 高手做过啊 ,。帮忙谢谢 。 IE9 + win7x64 + vs2010 web调试错误怎么办啊? JQuery实现文本框自动匹——请高人帮我看看 页面传递参数出错 关于workflow持久化, 一个简单的问题——连接 新手问题!为什么TextBox只能辨认数字? shanfen 有没有方法将dataset内容保存到数据库? 登录窗口 如何让输入用户名文本框 不记录已经输入的内容? 购物车功能!
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(Test),Page);
} [AjaxPro.AjaxMethod]
public string GetServerTimeString()
{
System.Threading.Thread.Sleep(2000);
return DateTime.Now.ToString();
}
function ajax_callback(response)
{
}
function getServerTime()
{
Test.GetServerTimeString(ajax_callback);
}
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="UI_AJAX_PAGE.aspx.cs" Inherits="UI_AJAX_PAGE" %><asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script type="text/javascript" language="javascript">
function comit_onclick() {
UI_AJAX_PAGE.SetTb(callback1);
}
function callback1(res) {
alert('aaaa');
}
</script> <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="alert('aaaa')"/>
</asp:Content>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;public partial class UI_AJAX_PAGE : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(UI_AJAX_PAGE),Page);
} [AjaxPro.AjaxMethod]
public string SetVale(string item)
{
return item;
}
}
用的是AjaxPro.2.dll
web.config:
<add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory,AjaxPro.2"/> protected void Page_Load(object sender, EventArgs e)
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(UI_AJAX_PAGE),Page);
} [AjaxPro.AjaxMethod]
public string SetValeData(string item)
{
return item;
} function comit_onclick() {
UI_AJAX_PAGE.SetValeData('aaa',callback1);
}
function callback1(res) {
alert(res);
}
你的按钮没有触发脚本呀