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 }
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 }
相关文章推荐
- Login control in an ASP.NET AJAX toolkit PopupControlExtender with a close button--write by Laurent Kempé
- asp.net Ajax Control Toolkit 34个服务器端控件
- AjaxControlToolkit 微软出的ajax.net 工具使用教程二十三 DropDownExtender(下拉对话框)控件的使用
- 《ASP.NET Ajax程序设计-第I卷:服务器端ASP.NET 2.0 AJAX Extensions与ASP.NET AJAX Control Toolkit》2007年4月16日 china-pub全国首发!+ 赠书名单已经确定
- Updated ASP.NET AJAX Control Toolkit Release and New ASP.NET AJAX Videos/Articles
- 《ASP.NET AJAX程序设计 第I卷 服务器端ASP.NET AJAX Extensions与ASP.NET AJAX Control Toolkit》连载&最新更新
- 《ASP.NET AJAX程序设计 第I卷 服务器端ASP.NET AJAX Extensions与ASP.NET AJAX Control Toolkit》试读及免费赠书活动
- ASP.NET AJAX Control Toolkit Update
- 轻松掌握Ajax.net系列教程二:部署Ajax Control Toolkit
- [转]轻松掌握Ajax.net系列教程二:部署Ajax Control Toolkit
- 轻松Ajax.net实例教程5_CascadingDropDown(按AjaxControlToolkit字母排序)
- ASP.NET AJAX Control Toolkit 控件速查
- Updated ASP.NET AJAX Control Toolkit Release and New ASP.NET AJAX Videos/Articles
- AjaxControlToolkit 微软出的ajax.net 工具使用教程七 使用UpdatePanel控件(二)
- AjaxControlToolkit 微软出的ajax.net 工具使用教程二十二 ConfirmButtonExtender (确认对话框)控件的使用
- 《ASP.NET Ajax程序设计-第I卷:服务器端ASP.NET 2.0 AJAX Extensions与ASP.NET AJAX Control Toolkit》2007年4月16日 china-pub全国首发!+ 赠书名单已经确定
- ASP.NET AJAX Control Toolkit Release 10301
- Asp.Net Ajax Control Toolkit 控件示范
- ASP.NET AJAX Control Toolkit 控件说明
- An example on how to use jQuery and Ajax.NET Professional together