All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
asp.net,ajax,1.0,hello,world程序_.net资料_编程技术

Writer: aaa Article type: Programming skills(编程技巧) Time: 2013/12/8 7:48:39 Browse times: 272 Comment times: 0

asp.net,ajax,1.0,hello,world程序_.net资料_编程技术


Head photo

Go homepage
Upload pictures
Write articles

asp.net ajax 1.0,hello world程序_.net资料_编程技术-你的首页-uuhomepage.com







asp.net ajax跟atlas有了很大不同。从这个简单的例子中可以看出几点。
<1>新建一个asp.net ajax-enabled web site
<2>页面布局。Server Controls的标签前缀(Tag Prefix)由atlas变为asp;




<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="HelloWorld" %>
http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">


Hello











你的名字:












<3>客户端脚本。调用服务的方法有些许改变。可以指定默认的回调方法。




<4>HelloWorldService服务代码。为了能使服务被asp.net ajax客户端调用,必须给服务指明[ScriptService]属性(为了使用这一属性,需要引用Microsoft.Web.Script.Services命名空间)。
1using System;
2using System.Web.Services;
3using System.Web.Services.Protocols;
4using Microsoft.Web.Script.Services;
5
6[WebService(Namespace = "http://tempuri.org/")]
7[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
8[ScriptService]
9public class HelloWorldService : System.Web.Services.WebService {
10
11 public HelloWorldService () {
12
13 //Uncomment the following line if using designed components
14 //InitializeComponent();
15 }
16
17 [WebMethod]
18 public string HelloWorld(string name) {
19 string hello = String.IsNullOrEmpty(name) ? "无名氏" : name;
20 hello += "你好,当前服务器时间是:";
21 hello += DateTime.Now.ToUniversalTime();
22 return hello;
23 }
24
25}





























There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.