ASP.NET 2.0 AJAXÖÐWebserviceµ÷Ó÷½·¨
ASP.NET 2.0 AjaxÖÐÄܹ»ÔÚ¿Í»§¶ËjsÖкܷ½±ãµØµ÷Ó÷þÎñÆ÷Webservice£¬ÒÔÏÂΪһЩµ÷ÓõÄʾÀý¡£±ÊÕß°²×°µÄASP.NET 2.0 AJAX
°æ±¾ÎªAJAX November CTP¡£
Èý¸öʾÀý·Ö±ðΪ£º
1 ´ø²ÎÊýµÄWS·½·¨
2 ²»´ø²ÎÊýµÄWS·½·¨
3 ²ÎÊýÀàÐÍΪDataTableµÄWS·½·¨
Ò»¡¢WebMethod
×¢ÒâÒªµã£º
1 WebMethodÀàÐèÒªÌí¼ÓÃüÃû¿Õ¼ä Microsoft.Web.Script.Services£¬´Ë¿Õ¼äÐèÒªÒýÓÃMicrosoft.Web.Preview.dll
2 ÀàÉùÃ÷¼ÓÈë±êÇ© [ScriptService]
3 ÔÚAsp.net 2.0Àï¿ÉÒÔÖ±½ÓÓÃDataTable×÷Ϊ·µ»ØÀàÐÍÁË£¬µ«ÊÇÐèÒªÔÚWeb.configÎļþÌí¼ÓÐòÁл¯×ª»»Æ÷µÄÊôÐÔ¡£DataSet¡¢DataTable¡¢DataRow¾ùÓÐת»»Æ÷
< system.web.extensions>
¡¡¡¡< scripting>
¡¡¡¡< webServices>
¡¡¡¡< jsonSerialization>
¡¡¡¡< converters>
¡¡¡¡< add name="DataSetConverter" type="Microsoft.Web.Preview.Script.Serialization.Converters.DataSetConverter, Microsoft.Web.Preview"/>
¡¡¡¡< add name="DataRowConverter" type="Microsoft.Web.Preview.Script.Serialization.Converters.DataRowConverter, Microsoft.Web.Preview"/>
¡¡¡¡< add name="DataTableConverter" type="Microsoft.Web.Preview.Script.Serialization.Converters.DataTableConverter, Microsoft.Web.Preview"/>
¡¡¡¡< /converters>
¡¡¡¡< /jsonSerialization>
¡¡¡¡< /webServices>
¡¡¡¡< /scripting>
¡¡¡¡< /system.web.extensions>
WEB·þÎñ1£ºWS1
using System;
¡¡¡¡using System.Web;
¡¡¡¡using System.Collections;
¡¡¡¡using System.Web.Services;
¡¡¡¡using System.Web.Services.Protocols;
¡¡¡¡using Microsoft.Web.Script.Services;
¡¡¡¡using System.Data;
¡¡¡¡/**////
¡¡¡¡/// WS1 µÄժҪ˵Ã÷
¡¡¡¡///
¡¡¡¡[WebService(Namespace = "http://tempuri.org/")]
¡¡¡¡[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
¡¡¡¡[ScriptService]
¡¡¡¡public class WS1 : System.Web.Services.WebService {
¡¡¡¡public WS1 () {
¡¡¡¡//Èç¹ûʹÓÃÉè¼ÆµÄ×é¼þ£¬ÇëÈ¡Ïû×¢ÊÍÒÔÏÂÐÐ
¡¡¡¡//InitializeComponent();
¡¡¡¡}
¡¡¡¡[WebMethod]
¡¡¡¡public string ServerTime()
¡¡¡¡{
¡¡¡¡return String.Format("now£º {0}", DateTime.Now);
¡¡¡
Ïà¹ØÎĵµ£º
´ò¿ªÐµĴ°¿Ú²¢´«ËͲÎÊý£º
´«ËͲÎÊý£º
response.write("<script>window.open('*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="++"')
</script>")
½ÓÊÕ²ÎÊý£º
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
2.Ϊ°´Å¥Ìí¼Ó¶Ô»°¿ò
Button1.Attributes.Add("oncl ......
DateTime dt = DateTime.Now;
// Label1.Text = dt.ToString();//2005-11-5 13:21:25
// Label2.Text = dt.ToFileTime().ToString();//127756416859912816
// Label3.Text = dt.ToFileTimeUtc().ToString();//127756704859912816
// Label4.Text = dt.ToLocalTime().ToString();//2005-11-5 21:21:25
// Label5.Text = ......
ÔÚ×öWEBϵͳ¿ª·¢Ê±£¬Ã¿Ã¿Óöµ½Ò³Ãæ´«ÖµµÄÎÊÌâ¶¼ÊÇÔÚʹÓÃ×î¼òµ¥µÄGET·½Ê½À´´«Öµ£¬Èç¹ûÐÅÏ¢Á¿±È½ÏÉÙ²¢ÇÒÓÖ²»Éæ¼°°²È«ÎÊÌâµÄ»°
»¹¿ÉÒÔÓ¦¸¶Ò»Ï£¬µ«ÊÇ´«µÝ´óÁ¿Êý¾Ý¡¢Ãô¸ÐÊý¾ÝµÄʱºò.....
ÏÂÃæ¾ÍASP.NETÖÐÒ³Ãæ´«Öµ·½Ê½×ö¸ö»ã×Ü£¬ÒÔ±¸²»Ê±Ö»Ðè
1¡¢GET´«Öµ·½Ê½
·¢ËÍÒ³Ãæ£º
  ......
ÔÚASP.NET Web´°ÌåÓ¦ÓóÌÐòÖУ¬ÍƼöµÄ·½·¨Êǽ«ÈÝÆ÷´æµ½ÓÉApplication×Öµä¶ÔÏóÌṩµÄÈ«¾Ö״̬¡£µ±ÐèÒªµÄʱºòÄã¿ÉÒÔ·ÃÎÊÈÝÆ÷£¬ÉõÖÁʹÓÃHTTPÄ£¿é×Ô¶¯Íê³É¶ÔÒ³ÃæÉϿؼþµÄ×¢Èë¡£
ͨ³£Çé¿öÏ£¬ÄãÓ¦¸ÃʹÓÃApplication×Öµä¶ÔÏóÀ´´æ´¢ÈÝÆ÷µÄµ¥¸öʵÀý¡£Äú¿ÉÄܾö¶¨´´½¨Ö÷ÒªÈÝÆ÷µÄ×ÓÈÝÆ÷£¬²¢½«ËüÃÇ´æ´¢µ½Ã¿¸öÓû§µÄSession¶ÔÏóÖУ¬ÉõÖÁ ......
Ó¦ÓÃ1£ºGridViewºÍCheckBox½áºÏ
Ч¹ûͼ£º
Ó¦ÓÃ2£ºExtending the GridView Control
Code download available at: CuttingEdge05.exe (132 KB)
Browse the Code Online
Contents
The GridView Difference
A New GridView Control
Adding a Checkbox Column
The New Grid In Action
Styling Selected ......