[תÌû]asp.net Ajax ÖÕ¼«½â¾ö·½°¸
ajax ÔÚÄ¿Ç° web ÁìÓòÒѹ㷺ӦÓã¬ÆäÕæÕýºËÐÄÖ»²»¹ýÊÇÒ»¸ö·â×°ºÃÁ赀 js ¿â¡£×îÎ廨°ËÃŵÄĪ¹ýÓÚ asp.net µÄ¿Ø¼þ£¬ÎÒ¸öÈËÈÏΪ ajax Ö»ÊÇÒ»¸öÇáÁ¿¼¶µÄ¶«Î÷£¬¸ù±¾Ã»ÓбØÒª½«Ëüд³É·þÎñÆ÷×é¼þ£¬Èç ajax.net¡¢AjaxControlToolkit µÈ¡£ËùÒÔÎÒÒ»Ö±ÊÓÕâЩ×é¼þΪÀ¬»ø¡£¡£¡£
ÒÔÏÂ˵Ã÷ÎÒΪʲô²»ÈÏͬ ajax µÄÏà¹Ø×é¼þ£º
1¡¢½« ajax ·â×°µÃÌ«ËÀ£¬³öÏÖÎÊÌâÄÑÓÚµ÷ÊÔ£»
2¡¢×é¼þ¹ýÓÚÓ·Ö×£¬Ì«¶àûÓÐÓõŦÄÜ£»
3¡¢ÒÀÀµÐÔÌ«Ç¿£¬ÉÙÒ»Ñù²»¿É£¬Èç webform£»
´«Í³µÄ ajax Ó¦Óõ½ÏîÄ¿ÖУ¬»á³öÏÖÓÉÓÚÏîÄ¿µÄ ajax Ó¦ÓÃÌ«¶à£¬·þÎñ¶ËµÄ ajax ÏìÓ¦º¯ÊýÄÑÓÚ¹ÜÀí£¬ÎÒÃǵ½µ×Òª°ÑÕâЩÏìÓ¦º¯Êý²¿ÊðÔÚʲôλÖã¿
¼ÙÈç
index.aspx ÀïÓÐÈý¸ö ajax ÏìÓ¦º¯Êý£¬ÎÒÃÇ¿ÉÒÔ°ÑÕâÈý¸öÏìÓ¦º¯Êý·ÅÔÚ index.aspx ÖУ¬²¢ÓÚ Page_Load ʼþÖиù¾Ý²ÎÊý²»Í¬À´µ÷ÓÃÕâЩº¯Êý¡£
index.aspx ÀﻹʹÓÃÁË abc.ascx£¬Õâ¸ö¿Ø¼þÀïÃæÒ²Óõ½ÁË ajax£¬ÄÇô abc.ascx ÀïµÄÏìÓ¦º¯ÊýÓÖÓ¦¸Ã·ÅÔÚÄÄÀindex.aspx ÖÐÂð£¿Èç¹û index2.aspx ÖÐÒ²Óõ½ÁË abc.ascx£¬ÄѵÀ»¹Òª¸´ÖÆ index.aspx µÄ´¦Àíº¯Êýµ½ index2.aspx£¬ÕâÑù¿Ï¶¨²»ÐУ»
ÎÒÃÇ¿ÉÒÔн¨Ò»¸ö ajax.aspx À´´¦ÀíËùÓÐµÄ ajax ÏìÓ¦£¬php/asp ¶¼¿ÉÒÔÕâÑù×ö¡£ÕâÑù¹ÜÀí»¹ÊDz»ÀíÏ룬
×îÀíÏëµÄ¹ÜÀí·½·¨Ó¦¸ÃÊÇÒ³Ãæ¡¢¿Ø¼þÓëÏìÓ¦º¯Êý¼¯³É¡£ICallBackEventHandler ¿ÉÒÔ×öµ½£¬µ«ÊÇËüÒÀÀµ webform£¬¼ÙÈçÄãµÄÒ³ÃæÖÐûÓÐÒ»¸ö £¬Ôò»áʧЧ¡£
ÎÊÌâ»Ø¹éµ½ÈçÌåʹÓÃÇáÁ¿¼¶ ajax£¬²¢ÊµÏÖÒ³Ãæ/¿Ø¼þÓë ajax ÏìÓ¦º¯Êý¼¯³É¡£
Reflector ²é¿´ System.Web.UI.Page ÀïÃæ´¦Àí ICallBackEventHandler Ä£¿éºó£¬ÎÒÃÇ¿ÉÒÔÕâÑù×ö£º
1¡¢ËùÓÐÒ³Ãæ¼Ì³Ð BasePage£»
2¡¢BasePage ¼Ì³Ð System.Web.UI.Page£¬ÖØд BasePage.OnLoad£»
3¡¢ÊµÏÖ AjaxHandler
4¡¢Ìí¼Ó Ajax À࣬ʵÏÖ Ajax.Register ¾²Ì¬·½·¨
´úÂëÈçÏ£º
public class BasePage : Page {
protected override void OnLoad(EventArgs e) {
AjaxHandler();
base.OnLoad(e);
}
ajax handler#region ajax handler
//ÎÒϲ»¶Óà json ¸ñʽÊý¾ÝÀ´·µ»Ø¸ø¿Í»§¶Ë´¦Àí
protected void AjaxHandler() {
Ïà¹ØÎĵµ£º
1.Ajax Rain
¡¡¡¡AjaxRainÓкܶàÍêÃÀÕûºÏAJAX, CSS, DHTML »ò JavascriptµÄʵÀý£¬ÓÐһЩDemoµÄÈ·ÖµµÃÄãÈ¥¿´Ò»¿´£¬¼´Ê¹Äã²»ÊÇÍøÒ³Éè¼Æ(¿ª·¢)ʦ¡£
Ajax/JavascriptʵÀý:
EXT JS Date Picker
jQuery Feed Menu
jGrowl
FastFind Menu – Jquery
Spiffy Accordion
2.Ajax Daddy ......
ajaxÓëxmlÊý¾Ý½»»¥
AJAX¿ÉÒÔͨ¹ýʹÓÃXMLÎļþÀ´ÈÃÐÅÏ¢²úÉú»¥¶¯
AJAX XML ʵÀý
ÔÚÏÈÃæµÄAJAXʵÀýÖÐÎÒÃǽ«ÑÝʾÈçºÎÈÃWEBÒ³ÃæʹÓÃAJAX¼¼ÊõÀ´»ñÈ¡µ½À´×ÔXMLÎļþµÄÐÅÏ¢
´ÓÏÂÀ¿òÖÐÑ¡ÔñÒ»ÅÌCD
Ñ¡ÔñCD: Bob DylanBonnie TylerDolly Parton
TITLE: Greatest Hits
ARTIST: Dolly Parton
COUNTRY: USA
COMPANY: RCA
PRICE: 9 ......
1£® Ê×ÏÈÏÂÔØ dwr.jar°ü£¬ÏÂÔصØÖ·: http://directwebremoting.org/dwr/
2£® ÔÚÓ¦ÓÃÖÐÒýÈë dwr.jar°ü
3£® ÐÞ¸Äweb.xmlÅäÖÃÎļþ
<servlet>
<servlet-name>dwr</servlet-name>
......
=================================<1>Ò³Ãæ¿ØÖÆ ======================================
<script type ="text/javascript" src="../js/Calendar.js"charset ="gb2312"></script>
<input ID="Text1" type="text" runat="server" onfocus="calendar()"/>
<!- ......
µ± ASP.NET ½ÓÊÕÕë¶ÔÒ³µÄÇëÇóʱ£¬Ëü´ÓÏ̳߳ØÖÐÌáÈ¡Ò»¸öÏ̲߳¢½«ÇëÇó·ÖÅä¸ø¸ÃÏ̡߳£
Ò»¸öÆÕͨµÄ£¨»òͬ²½µÄ£©Ò³ÔÚ¸ÃÇëÇóÆڼ䱣ÁôỊ̈߳¬´Ó¶ø·ÀÖ¹¸ÃÏß³ÌÓÃÓÚ´¦ÀíÆäËûÇëÇó¡£Èç¹ûÒ»¸öͬ²½ÇëÇó³ÉΪ I/O bound£¨ÀýÈ磬Èç¹ûËüµ÷ÓÃÒ»¸öÔ¶³Ì Web ·þÎñ»ò²éѯһ¸öÔ¶³ÌÊý¾Ý¿â£¬²¢µÈ´ýµ÷Ó÷µ»Ø£©£¬ÄÇô·ÖÅä¸ø¸ÃÇëÇóµÄÏß³ÌÔÚµ÷Ó÷µ»Ø֮ǰ´ ......