#眉標=ASP.NET
#副標=ASP.NET Atlas
#大標=使用Atlas開發新一代的ASP.NET網頁程式
==========程式=========
程式1
var textbox1 = new Web.UI.TextBox
(document.getElement(‘Textbox1'));
textbox1.initialize();
var label1 = new Web.UI.Label
(document.getElement(‘Label1'));
var binding1 = new Web.Binding();
binding1.set_dataContext(textbox1);
label1.get_bindings().add(binding1);
label1.initialize();
==========程式=========
==========程式=========
程式2
==========程式=========
==========程式=========
程式3
==========程式=========
==========程式=========
程式4
==========程式=========
==========程式=========
程式5
<%@ Master Language="C#" %>
==========程式=========
==========程式=========
程式6
using com.google.api;
using com.msn.search;
using com.msn.search.soap;
public class Search :
System.Web.Services.WebService
{[WebMethod]
public string SearchGoogle(String query){
GoogleSearchService s =
new GoogleSearchService();
string txtkey ="請在此處填入Google Developer ID";
GoogleSearchResult r =s.doGoogleSearch(txtkey,
query,0, 10, false, "", false, "", "", "");
ResultElement[] re = r.resultElements;
string strtmp = string.Empty;
for (int i = 0; i < re.Length; i++)
strtmp += "標題:
" + re[i].title +
"
網址:
" + re[i].URL +
"
";return strtmp;}
[WebMethod]
public string SearchMSN(String query){
MSNSearchService s = new MSNSearchService();
SearchRequest searchRequest = new
SearchRequest();
searchRequest.AppID =
"請在此處填入MSN Developer ID ";
中略…
}
==========程式=========
==========程式=========
程式7
public class AutoCompleteService :
System.Web.Services.WebService {
private static string[]
autoCompleteWordList = null;
[WebMethod]
public String[] GetWordList
(string prefixText, int count) {
if (autoCompleteWordList == null){
List words = new List();
FileStream file = new FileStream(
Server.MapPath("~/App_Data/words.txt"),
FileMode.Open, FileAccess.Read);
StreamReader reader = new StreamReader(file);
String word;
while ((word = reader.ReadLine()) != null) {
words.Add(word);}file.Close();
autoCompleteWordList = words.ToArray();
Array.Sort(autoCompleteWordList,
new CaseInsensitiveComparer());}
int index = Array.BinarySearch(
autoCompleteWordList, prefixText,
new CaseInsensitiveComparer());
if (index < 0) {index = ~index; }
int matchingCount; for (matchingCount = 0;
matchingCount < count && index +
matchingCount < autoCompleteWordList.Length;
matchingCount++){
if (!autoCompleteWordList[index +
matchingCount].StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase)){
break; }}
String[] returnValue = new string[matchingCount];
if (matchingCount > 0){
Array.Copy(autoCompleteWordList,
index, returnValue, 0, matchingCount);}
return returnValue;}}}
==========程式=========
==========程式=========
程式8
<%@ Page Language="C#"
MasterPageFile="~/Default.master"
Title="Atlas Search" %>
==========程式=========