您的位置:首页 > Web前端

AJAX Framework四个框架:AJAX Control Toolkit,MagicAjax.NET,Anthem.NET,Ajax.NET Professional

2010-09-14 18:56 441 查看
from:

AJAX Control Toolkit http://ajaxcontroltoolkit.codeplex.com/

MagicAjax.NET http://sourceforge.net/projects/magicajax/

Anthem.NET http://sourceforge.net/projects/anthem-dot-net/ http://anthemnxt.codeplex.com/

Ajax.NET Professional http://www.ajaxpro.info/ http://ajaxpro.codeplex.com/

Ajax.NET Professional Starter Kit http://www.codeplex.com/wikipage?ProjectName=AjaxProStarterKit

这是一个Apress出版的一本《Pro Ajax and the NET2.0 Platform》作者:Daniel Woolston (原代码下载:Apress.com)的一个Anthem.net代码示例.SQL2005示例数据库,本人只是初步了解,希望有高人指教.

只需引用Anthem.DLL文件,不需Web.Config文件配置,Ajax.NET需要配置

服务器端代码

1 using System;
2 using System.Data;
3 using System.Configuration;
4 using System.Collections;
5 using System.Web;
6 using System.Web.Security;
7 using System.Web.UI;
8 using System.Web.UI.WebControls;
9 using System.Web.UI.WebControls.WebParts;
10 using System.Web.UI.HtmlControls;
11 using System.Data.SqlClient;
12
13
14 public partial class SearchPage_DataSets : System.Web.UI.Page
15 {
16 protected void Page_Load(object sender, EventArgs e)
17 {
18 // We need to register this page with Ajax class, so that it is
19 // Ajax.Net Aware.
20 Anthem.Manager.Register(this);
21
22 }
23
24
25 [Anthem.Method]
26 public DataSet RetrieveRows(string searchterm)
27 {
28 //SQL 2005
29
30 SqlConnection conn = new SqlConnection(
31 "Data Source=B2FC96ADD7DC472\\GEOVINDU;Initial Catalog=AdventureWorks;Integrated Security=SSPI");
32 DataTable dtReturn = new DataTable();
33
34 conn.Open();
35 // Go get the top 10 store names from AdventureWorks that are like users search criteria
36 SqlCommand cmd = new SqlCommand("Select Top 10 Name from sales.store where Name like @searchterm Order By Name", conn);
37 SqlParameter param = new SqlParameter();
38 param.ParameterName = "@searchterm";
39 searchterm.Trim().Replace("'", "''");
40 searchterm += "%";
41 param.Value = searchterm;
42 cmd.Parameters.Add(param);
43 SqlDataAdapter adpt = new SqlDataAdapter(cmd);
44 DataSet dsCustomers = new DataSet();
45 adpt.Fill(dsCustomers, "stores");
46
47 conn.Close();
48
49
50 // send the DataTable back to the CallBack function
51 return dsCustomers;
52 }
53
54 }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐