• 如何:从 Web 服务客户端上进行异步调用


    <%@ Page Language="C#" %>
    <%@ Import Namespace="System.Net" %>
    <html>
       
    <script language="C#" runat="server">
          
    void EnterBtn_Click(Object Src, EventArgs E) 
          
    {
             MyMath.Math math 
    = new MyMath.Math();
             
    // Call to Add Web service method asynchronously 
             
    // and then wait for it to complete.
             IAsyncResult result =
                             math.BeginAdd(Convert.ToInt32(Num1.Text),
                                           Convert.ToInt32(Num2.Text),
                                           
    null,
                                           
    null);
             
    // Wait for asynchronous call to complete.
             result.AsyncWaitHandle.WaitOne();
             
    // Complete the asynchronous call to Add Web service method.
             float total = math.EndAdd(result);
             
    // Display results in a Label control.
             Total.Text = "Total: " + total.ToString();
          }

       
    </script>
    <body>
       
    <form action="MathClient.aspx" runat=server>
          
    <font face="Verdana"> 
             Enter the two numbers you want to add and then press 
             the Total button.
             
    <p>
             Number 
    1
             
    <asp:textbox id="Num1" 
             runat
    =server/>  
             
    +
             Number 
    2
             
    <asp:textbox id="Num2" 
                  runat
    =server/> 
             
    =
             
    <asp:button id="Total_Button"
                  text
    ="Total" 
                  OnClick
    ="EnterBtn_Click" 
                  runat
    =server/>
             
    <p>
             
    <asp:label id="Total" runat=server/>
          
    </font>
        
    </form>
    </body>
    </html>
  • 相关阅读:
    Registering a Visual Studio .Net AddIn without an Installer
    广州的.Net Fans俱乐部的T恤和Logo的设计
    模板控件概念(转)
    随笔-在广州.Net俱乐部的一个下午
    快速备份Outlook中的资料
    web.config文件详解
    使用RAPI库操作移动设备——C#语言描述 (转贴)
    Ready to Rock 撼动未来:SQL Server 2005 ,Visual Studio 2005, BizTalk Server 2006 新品发布会 报名
    IBM Rational Solutions V2003
    VS.Net 2003 IDE 插件开发指南
  • 原文地址:https://www.cnblogs.com/wzyexf/p/389744.html
Copyright © 2020-2023  润新知