̽Ë÷Asp.netµÄPostback»úÖÆ
/* from: http://www.techmango.com/blog/article/DotNet/Explore_Asp_net_postback_mechanism.htm */
__doPostBack×÷ΪÔÚasp.netÖÐÒ»¸öºÜºËÐĺÜÖØÒªµÄ²¿·Ö,ÎÒÃÇÓбØÒªÉîÈëÁ˽âÒ»ÏÂ.
Æäʵ,__doPostBackÊÇÒ»¸öºÜ¼òµ¥µÄ½Å±¾º¯Êý.´úÂëÈçÏÂ:
//__doPostBack<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /><input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />function __doPostBack(eventTarget, eventArgument) {if (!theForm.onsubmit || (theForm.onsubmit() != false)) {theForm.__EVENTTARGET.value = eventTarget;theForm.__EVENTARGUMENT.value = eventArgument;theForm.submit();}}
ÔÀ´ÊÇÔÚsubmitÉÏ×öÎÄÕ°¡.microsoft³ÊÏÖ¸øÎÒÃǵľÍÊÇÕâÖÖ¾«ÇɵÄ˼ά!
ÎÒ¿´µ½,asp.netÏÖÔÚÒ³ÃæÉÏÌí¼ÓÁËÁ½¸öhidden input,ÕâÁ½¸öinput·Ö±ðÓÃÀ´´æ·Å´¥·¢postbackµÄcontrolµÄIDºÍ²ÎÊý.Õâ¾ÍÊÇÎÒÃǴ󲿷ÖÈËÈÏʶµ½µÄ:
__doPostBack(obj1,obj2)µÄµÚÒ»¸ö²ÎÊýÊǿؼþID,µÚ¶þ¸ö²ÎÊýÊÇpostbackµÄ²ÎÊý.È»ºó¾Í¿ÉÒÔÔÚºǫ́ÓÃRequest.Form["__EVENTTARGET"]ºÍ Request.Form["__EVENTARGUMENT"]È¡µÃ¿Ø¼þIDºÍ²ÎÊý.
²»¹ý,ÁíÍâҪעÒâµÄ¾ÍÊÇasp.netµÄwebcontrolsÖÐ,Button»òÆäËü***Button,ÈçImageButton¾ÍÌØÊâÁË,ËüÃDz»ÊÇÀûÓà __doPostBackÀ´ÊµÏÖpostbackµÄ.ΪʲôÕâÑù,¿ÉÄÜÒòΪButtonÔÚhtmlÖб¾À´¾ÍÊÇÓд¥·¢submitʼþµÄ¹¦ÄÜ°É.asp.net²»¹ýÊÇÒªÁîÔÀ´htmlÖÐһЩ²»ÄÜ´¥·¢submitµÄ¶«Î÷submit,²ÅŪ³öÁË__doPostBackÀ´ÊµÏÖ°É.
ËùÒÔÈç¹ûÊÇButtonµÄpostback,ÔÚºǫ́ÊDz»ÄÜÓÃRequest.Form["__EVENTTARGET"]ºÍRequest.Form["__EVENTARGUMENT"]È¡µÃ¿Ø¼þIDºÍ²ÎÊýµÄ.ÄÇô,ÔõôȡÄØ?¿´´úÂë:
//È¡Buttonforeach (string str in Request.Form){ Control c = Page.FindControl(str); if (c is Button) { control = c; break; }}
ÉÏÊöд·¨¿ÉÒÔÔÚºǫ́ÕÒµ½Button.ÔÚButtonµÄÌá½»¹ý³ÌÖÐ,Button»á½«Button±¾ÉíµÄID×÷ΪRequest.FormµÄÒ»¸öKey£¬ËüµÄValueÊÇButtonµÄ TextÊôÐÔÖµ£¬»Ø´«¸ø·þÎñÆ÷.ËùÒÔ¿ÉÒÔÔÚºǫ́ѻ·Form.KeysÈ¡µ½ËùÌá½»µÄButton,ÒÔÖ´ÐÐÏàÓ¦µÄº¯Êý.ImgButtonÒ²²î²»¶à,²»Í¬¾ÍÔÚÓÚ£¬Ëü²»ÊÇÓÃImageButtonµÄID×÷ΪRequest.FormµÄKey£¬ËüÊÇÓÃImageButtonµÄID¼ÓÉÏ.xºÍ.y×÷ΪKey£¬ÔÚ Request.FormÌí¼ÓÁ½ÉϼüÖµ¶Ô£¬ÕâÁ½¸ö¼üÖµÓ¦¸ÃÊǶÔÓ¦ImageButtonµÄͼƬ´
Ïà¹ØÎĵµ£º
²Î¿¼ http://topic.csdn.net/t/20040510/19/3051316.html
¿ªÊ¼
ÔËÐÐ
dcomcnfg
×é¼þ·þÎñÒ»ÏîÖÐÑ¡ÔñDcomÅäÖã¬ÕÒµ½Microsoft excelÓ¦ÓóÌÐò£¬²ì¿´ÊôÐÔ
°²È«Ñ¡ÏÖУ¬Æô¶¯È¨Ï޺ͷÃÎÊȨ ......
¶ÁXMLÎļþ
DataSet books = new DataSet();
books.ReadXml(MapPath("booklist.xml"));
booklist.DataSource = books;
booklist.DataBind(); ......
ASP.NET AJAXÈëÃÅϵÁн«»áд¹ØÓÚASP.NET AJAXһЩ¿Ø¼þµÄʹÓ÷½·¨ÒÔ¼°»ù´¡ÖªÊ¶£¬ÆäÖв¿·ÖÎÄÕÂΪԴ´£¬Ò²ÓÐһЩÎÄÕÂÊÇÖ±½Ó·Òë×Ô¹Ù·½Îĵµ£¬±¾²¿·ÖÄÚÈݻ᲻¶Ï¸üС£
Ŀ¼
ASP.NET AJAXÈëÃÅϵÁУ¨1£©£º¸ÅÊö
µ¼¶Á£º×÷Ϊ±¾ÏµÁÐÎÄÕµĿªÆª£¬¼òµ¥½éÉÜÒ»ÏÂASP.NET AJAXµÄ¸Å¿ö¼°¸÷¸ö×é³É²¿·Ö¡£
......
Äú¿ÉÒÔʹÓÃHTTPÄ£¿é£¬Ò»¸öµ½ASP.NET HttpApplicationStateÀàµÄÀ©Õ¹£¬ÔÚGlobal.asax±àд´úÂëÇ¿ÖÆASP.NETÔÚÿһ¸öÒ³ÃæÇëÇóʱ×Ô¶¯×¢ÈëÒÀÀµµÄ¶ÔÏ󣬾ÍÏñÔÚASP.NET Web´°ÌåÓ¦ÓóÌÐòÖÐÌÖÂÛµÄÒ»Ñù.
ÏÂÁз½·¨ÏÔʾÁËÒ»¸öºÏÊʵķ½·¨Äܹ»»ñÈ¡PreRequestHandlerExecuteʼþ½«Ëü×Ô¼º×¢Èëµ½ASP.NE ......