zoukankan      html  css  js  c++  java
  • Ajaxpro.dll 配置及使用

    1.引入dll到bin目录下  [下载Ajaxpro.dll]

    2.配置web.config:
    Code

    3.配置全局应用程序

    public class Global : System.Web.HttpApplication
    {
        
    protected void Application_Start(object sender, EventArgs e)
        
    {
            AjaxPro.Utility.HandlerPath 
    = "ajaxpro";
        }


        
    protected void Application_End(object sender, EventArgs e)
        
    {

        }

    }

    4.使用:

    后台代码:

    要用AJAX方法的页page_load里加入注册

    AjaxPro.Utility.RegisterTypeForAjax(typeof(ajax方法所在的类名));

    这个注册方法是它自带的,实际的操作给源码加两条注册代码

    Code

    Plugins.MessageSystem.MessageCore指写ajax方法的类命名空间

    MessageSystem指该项目的dll名

     

    ajax方法编写(在上面提到的注册的类里)返回字符串

    [AjaxPro.AjaxMethod]
    // [AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.ReadWrite)] 这样可以操作session
    public string Getdbdata()
    {
        
    return HttpContext.Current.Application["abc"].ToString();
    }

    前台脚本调用:

    注册过的页面的脚本

    function fun1()
    {
        var text
    =<注册过的ajax方法所在类>.<ajax方法()>.value;
         alert(text);
    }

    ajax编写方法,返回集合:

    Code

    前台调用

    Code
  • 相关阅读:
    android 项目学习随笔十五(ShareSDK开放平台)
    android 项目学习随笔十四(WebView)
    android 项目学习随笔十三(ListView实现ITEM点击事件,将已读状态持久化到本地)
    android 项目学习随笔十二(ListView加脚布局)
    android 项目学习随笔十一(ListView下拉刷新提示)
    android 项目学习随笔十(自定义ProgressBar)
    android 项目学习随笔九(ListView加头布局)
    android 项目学习随笔八(xUtils的BitmapUtils模块)
    android 项目学习随笔七(ViewPagerIndicator与ViewPager)
    android 项目学习随笔六(网络缓存)
  • 原文地址:https://www.cnblogs.com/di305449473/p/1215471.html
Copyright © 2011-2022 走看看