• ajaxpro配置与使用


    1):下载ajaxpro.dll 放在bin 添加引用
    2):在web.config配置
      <system.web>
      <httpHandlers>
       <add verb="POST,GET" path="ajaxPro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro" />
      </httpHandlers>
    3)后台codebehind cs:
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;
    using AjaxPro;

    namespace ajax
    {
        /// <summary>
        /// WebForm1 的摘要说明。
        /// </summary>
        public class WebForm1 : System.Web.UI.Page
        {
            protected System.Web.UI.WebControls.TextBox TextBox1;
            protected System.Web.UI.WebControls.Label Label1;
       
            private void Page_Load(object sender, System.EventArgs e)
            {
              //注册
              AjaxPro.Utility.RegisterTypeForAjax(typeof(WebForm1));
       
            }
            //方法
            [AjaxPro.AjaxMethod()]
            public string TestMehtod(string name)
            {
                return this.BuildMessage(name);
            }
            protected string BuildMessage(string name)
            {
                return string.Format("Hello{0}!welcome to ajaxpro's world",name);
            }
    4)前台页面html

    WebForm1 <%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="ajax.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="javascript" type="text/javascript">
               function TF()
                {
                  
                  var sm=ajax.WebForm1.TestMehtod("zqf");
                  return sm.value;
                }
            </script>
        </HEAD>
        <body>
            <form id="Form1" method="post" runat="server">
                <FONT face="宋体">
                    <asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
                    <asp:Label id="Label1" runat="server" Width="88px">Label</asp:Label></FONT>
            </form>
            <script language="javascript">
            document.write(TF());
            </script>
        </body>
    </HTML>


  • 相关阅读:
    Discuz!X/数据库操作方法
    使用 HTML5, javascript, webrtc, websockets, Jetty 和 OpenCV 实现基于 Web 的人脸识别
    ECShop模板原理
    ecshop中smarty最常用的6大基本语法
    Laravel学习笔记
    Laravel的目录结构分析
    Intellij Idea 常用快捷键
    Code optimization and organization in Javascript / jQuery
    Bossies 2015: The Best of Open Source Software Awards
    解决jetty runner锁定js
  • 原文地址:https://www.cnblogs.com/smallfa/p/949675.html
Copyright © 2020-2023  润新知