• 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>


  • 相关阅读:
    移动端开发常遇问题解答
    CSS属性小结之--半透明处理
    jquery事件代理
    sprite图在移动端的使用
    vertical-align及IE7下的inline-block
    图片延迟加载
    iOS NSInteger/NSUInteger与int/unsigned int、long/unsigned long之间的区别!
    GCD深入理解(1)
    iOS 开发图片资源选择png格式还是jpg格式
    iOS沙盒(sandbox)机制及获取沙盒路径
  • 原文地址:https://www.cnblogs.com/smallfa/p/949675.html
Copyright © 2020-2023  润新知