ASP.NET UpdatePanel ¿Ø¼þ¸ÅÊö
ʹÓà ASP.NET UpdatePanel ¿Ø¼þ¿ÉÉú³É¹¦ÄܷḻµÄ¡¢ÒÔ¿Í»§¶ËΪÖÐÐÄµÄ Web Ó¦ÓóÌÐò¡£Í¨¹ýʹÓà UpdatePanel ¿Ø¼þ£¬¿ÉÒÔË¢ÐÂÒ³µÄÑ¡¶¨²¿·Ö£¬¶ø²»ÊÇʹÓûط¢Ë¢ÐÂÕû¸öÒ³Ãæ¡£Õâ³ÆΪִÐГ²¿·ÖÒ³¸üД¡£°üº¬Ò»¸ö ScriptManager ¿Ø¼þºÍÒ»¸ö»ò¶à¸ö UpdatePanel ¿Ø¼þµÄ ASP.NET ÍøÒ³¿É×Ô¶¯²ÎÓ벿·ÖÒ³¸üУ¬¶ø²»ÐèÒª×Ô¶¨Òå¿Í»§¶Ë½Å±¾¡£
Ò»¡¢½éÉÜ
UpdatePanel ¿Ø¼þͨ¹ýÖ¸¶¨Ò³ÖÐÎÞÐèË¢ÐÂÕû¸öÒ³Ãæ¼´¿É¸üеÄÇøÓò·¢»Ó×÷Óᣴ˹ý³ÌÓÉ ScriptManager ·þÎñÆ÷¿Ø¼þºÍ¿Í»§¶Ë PageRequestManager ÀàÀ´Ðµ÷¡£µ±ÆôÓò¿·ÖÒ³¸üÐÂʱ£¬¿Ø¼þ¿ÉÒÔͨ¹ýÒì²½·½Ê½·¢²¼µ½·þÎñÆ÷¡£Òì²½»Ø·¢µÄÐÐΪÓë³£¹æ»Ø·¢ÀàËÆ£ºÉú³ÉµÄ·þÎñÆ÷Ò³Ö´ÐÐÍêÕûµÄÒ³ºÍ¿Ø¼þÉúÃüÖÜÆÚ¡£²»¹ý£¬Í¨¹ýʹÓÃÒì²½»Ø·¢£¬¿É½«Ò³¸üÐÂÏÞÖÆΪ°üº¬ÔÚ UpdatePanel ¿Ø¼þÖв¢±ê¼ÇΪҪ¸üеÄÒ³ÇøÓò¡£·þÎñÆ÷½ö½«ÊÜÓ°ÏìµÄÔªËØµÄ HTML ±ê¼Ç·¢Ë͵½ä¯ÀÀÆ÷¡£ÔÚä¯ÀÀÆ÷ÖУ¬¿Í»§¶Ë PageRequestManager ÀàÖ´ÐÐÎĵµ¶ÔÏóÄ£ÐÍ (DOM) ²Ù×÷ÒÔ½«ÏÖÓÐ HTML Ì滻Ϊ¸üеıê¼Ç¡£
˵Ã÷£º ʹÓÃÒì²½»Ø·¢»òʹÓà XMLHTTPRequest ¶ÔÏóʱ£¬Èç¹û URL °üº¬Ë«×Ö½Ú×Ö·û£¬Ôò¿ÉÄÜ·¢Éú»Ø·¢´íÎó¡£´ËÎÊÌâ¿ÉÒÔͨ¹ýÏÂÃæµÄ·½·¨µÃµ½½â¾ö£ºÔÚÒ³ÃæµÄ head ÔªËØÖмÓÈë <base href="url"/> ÔªËØ£¬ÆäÖÐ href ÊôÐÔÉèÖÃΪÒýÓøÃÒ³ÃæµÄ URL ±àÂëµÄ×Ö·û´®¡£¿ÉÒÔÌí¼Ó¶¯Ì¬Ìí¼Óµ½·þÎñÆ÷´úÂëÖеĴËÔªËØ¡£
ÏÂͼÑÝʾһ¸öÊ״μÓÔصÄÒ³ºÍÒ»¸öºóÐøÒì²½»Ø·¢£¬¸Ã»Ø·¢½«Ë¢Ð UpdatePanel ¿Ø¼þµÄÄÚÈÝ¡£
1.1¡¢²¿·ÖÒ³³ÊÏÖ¸ÅÊö
1.2¡¢ÆôÓò¿·ÖÒ³¸üÐÂ
UpdatePanel ¿Ø¼þÔÚÍøÒ³ÖÐÐèÒª ScriptManager ¿Ø¼þ¡£Ä¬ÈÏÇé¿öÏ£¬½«ÆôÓò¿·ÖÒ³¸üУ¬ÒòΪ ScriptManager ¿Ø¼þµÄ EnablePartialRendering ÊôÐÔµÄĬÈÏֵΪ true¡£
ÏÂÃæµÄʾÀýÏÔʾÓÃÓÚ¶¨ÒåÒ³ÃæÉ쵀 ScriptManager ¿Ø¼þºÍ UpdatePanel ¿Ø¼þµÄ±ê¼Ç¡£UpdatePanel ¿Ø¼þ°üº¬Ò»¸ö Button ¿Ø¼þ£¬µ±µ¥»÷¸Ã¿Ø¼þʱ£¬½«Ë¢ÐÂÃæ°åÖеÄÄÚÈÝ¡£Ä¬ÈÏÇé¿öÏ£¬ChildrenAsTriggers ÊôÐÔΪ true¡£Òò´Ë£¬Button ¿Ø¼þ½«ÓÃ×÷Òì²½»Ø·¢¿Ø¼þ¡£
<asp:ScriptManager ID="ScriptManager"
runat="server" />
<asp:UpdatePanel ID="UpdatePanel1"
&nb
Ïà¹ØÎĵµ£º
If you come to ASP.NET MVC from a purely ASP.NET Web Forms background, one of the first things you are likely to notice is that all those nice easy Server Controls have disappeared. One of those is the FileUpload, and its absence seems to cause a few problems. This article looks at how to upload f ......
תÔØһƪ¹ØÓÚASP.NETÒ³ÃæÉúÃüÖÜÆÚÎÄÕÂ,ÓбØÒªÁ˽âÒÅÒ»ÏÂÒ³Ãæ³õʼ¹ý³Ìµ½µ×ÊÇÔõôÑùµÄ
ÏÂÃæÊÇASP.NETÒ³Ãæ³õʼµÄ¹ý³Ì:
1. Page_Init();
2. Load ViewState;
3. Load Postback data;
4. Page_Load();
5. Handle control events;
6. Page_PreRender();
7. Page_Render();
8. Unload event;
9. Dispose method called;
......
public class Up_Loadcs
{
public string[] Resup={"ÉÏ´«Ê§°Ü»òÖ¸¶¨µÄÎļþ²»´æÔÚ","ͼƬ´óÓÚ10K£¬ÖØд«Í¼Æ¬£¡","¸ñʽ²»¶Ô£¬ÏÞÖÆÉÏ´«£¨Ö»ÔÊÐígif/jpg¸ñʽÎļþ£©£¡","ÉÏ´«³É¹¦£¡"};
public string s = string.Empty;
&n ......
Õ⼸ÌìÅöµ½¸öºÜÆæ¹ÖµÄÎÊÌ⣬ƽ³£ÔÚÏîÄ¿Öдӹ¤¾ßÏäÖУ¬°Ñ¿Ø¼þÍϵ½±à¼Çø£¬ÄÇÊÇÔÙ¼òµ¥ÈÝÒײ»¹ýÁË¡£
¿ÉÊǼ¸ÌìÇ°Åöµ½¾ÍÊÇ£¬ÎÞÂÛÄãÔõôÍÏ£¬¶¼ÎÞ·¨Íϵ½±à¼ÇøÖУ¬Çл»µ½Ô´Â룬ÔÙÍϵÄʱºòÊÇ¿ÉÒԵģ¬²úÉúÁËHTML´úÂë
£¬ÔÙ½«ËüתÊÓͼµÄʱºò£¬·¢ÏÖÎÞ ·¨Õý³£ÏÔʾ¿Ø¼þ£¬£¬ËµÊÇÎÞ·¨ÕÒµ½¸ÃÒ³Ãæ¡£¡£¡£¡£¡£
н¨Á˼¸´ÎÒ²ÊDz»ÐУ¬ÒÔΪÊÇVS³ ......
ÔÚ¿ª·¢ÐèÒªÓû§×¢²áºó²ÅÄÜʹÓÃÌṩµÄ¸÷ÏÄܵÄÓ¦ÓóÌÐòʱ£¬ÔÚÐÂÓû§Ìá½»×¢²áÐÅÏ¢ºó£¬½Ï³£¼ûµÄ×ö·¨ÊÇÓɳÌÐòÉú³ÉËæ»úÃÜÂ룬Ȼºó·¢ËÍÃÜÂëµ½Óû§×¢²áʱÌîдµÄµç×ÓÐÅÏ䣬Óû§ÔÙÓÃÊÕµ½µÄÃÜÂëÀ´¼¤»îÆäÕÊ»§¡£
ʵÏÖASP.NETÉú³ÉËæ»úÃÜÂ빦ÄÜÊǺÜÈÝÒ׵ģ¬ÏÂÃæµÄ´úÂë¸ø³öÁËÍêÕûµÄʵÏÖ·½·¨£º
publicstaticstringMakePassword(stringpw ......