Asp.net ajax program design notebook 1 --

Related Tags:

  HelloWorldWebService.cs 

  [WebService (Namespace = "http://tempuri.org/")] 
  [WebServiceBinding (ConformsTo = WsiProfiles.BasicProfile1_1)] 
  [System.Web.Script.Services.ScriptService ()]// must write 
  Public class HelloWorldWebService: System.Web.Services.WebService ( 

  Public HelloWorldWebService () ( 

  / / If the use of design components, please note the following line 
  / / InitializeComponent (); 
  ) 

[WebMethod]
  Public string HelloWorld (string name) ( 
  Return "Welcome to website" + name; 
  ) 

  ) 

  HelloWorld.aspx 

  <script Type="text/javascript"> 
  Var g_tbName = null; 
  Var g_btnSayHello = null; 
  Var g_lbMsg = null; 

  Function pageLoad () ( 
  G_tbName = new Sys.Preview.UI.TextBox ($ get ( 'tbName')); 
  G_tbName.initialize (); 
  G_btnSayHello = new Sys.Preview.UI.Button ($ get ( 'btnSay')); 
  G_btnSayHello.add_click (getServerHello); 
  G_btnSayHello.initialize (); 
  G_lbMsg = new Sys.Preview.UI.Label ($ get ( 'lblMsg')); 
  G_lbMsg.initialize (); 
  ) 
  Function getServerHello () ( 
  HelloWorldWebService.HelloWorld (g_tbName.get_text (), cb_getServerHello); 
  ) 
  Function cb_getServerHello (result) ( 
  G_lbMsg.set_text (result); 
  ) 
  </ Script> 

  <form Id="form1" runat="server"> 
  <asp:ScriptManager ID="ScriptManager1" runat="server"> 
<Scripts>
  <asp:ScriptReference Name="PreviewScript.js" Assembly="Microsoft.Web.Preview" /> 
  </ Scripts> 
<Services>
  <asp:ServiceReference Path="HelloWorldWebService.asmx" /> 
  </ Services> 
  </ Asp: ScriptManager> 
<div>
  <asp:TextBox ID="tbName" runat="server"> </ asp: TextBox> 
  <input ID="btnSay" type="button" value="Button" /> 
  <br /> 
  <asp:Label ID="lblMsg" runat="server"> </ asp: Label> </ div> 
  </ Div ><!-- form, do not necessarily have to server controls, html can, as long as the correct id attribute on the trip -> 




Related articles:

Sogou: Google is catching up at Baidu
  In addition to the Internet can shorten the distance between you and I, Tianyagongcishi, also become the best platform for fighting wars of words, because he and low cost, speed, wide ramifications, and strong interaction.    This is not, the "two tigers" sustain resolved...
Ten website optimization method - Tags chapter keyword articles
  Why use html meta tag?    1.    Meta tag embedded in your website is the special html tags contain the website you have some of your hidden information.    Meat labelling is the role of search engines to explain your website is about what information.  &nb...
Html tags everywhere in danger of the potential safety problems
  WWW Internet service is the most important one of the services to provide customers with a wide range of information resources, and information resources to organize such a very important thing is Html hypertext language, and then after the development of emerging applications Other labels s...
Flash the most commonly used phrase (pool)
  Box_btn.onPress = function () (    Trace ( "ok");    );    Name button examples. Event handler method = function () (    / / Procedures    );    For example:    N = 1    Box_btn.onRelease = func...