zoukankan      html  css  js  c++  java
  • 如何:从 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>
  • 相关阅读:
    从滴滴flinkCEP说起
    从零讲Java,给你一条清晰地学习道路!该学什么就学什么!
    从coalesce算子发散开的
    从架构理解价值-我的软件世界观
    为什么说Redis是单线程的?
    全排列_获取第几个排列_获取是第几个排列__康托展开,逆康托展开
    求排列是全排列的第几个,求第几个是全排列___康托展开,逆康托展开
    搜索入门_简单搜索bfs dfs大杂烩
    无根树同构_hash
    乘法逆元_三种方法
  • 原文地址:https://www.cnblogs.com/wzyexf/p/389744.html
Copyright © 2011-2022 走看看