Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

asp.net Ò³ÃæÉú´æÖÜÆÚ ×ª

1. PreInit()ÔÚÕâ¸öÒ³Ã漶µÄʼþÖУ¬ËùÓÐÔÚÉè¼Æʱ´´½¨µÄ¿Ø¼þ¶¼½«±»ÓÃĬÈÏÖµ×ö³õʼ»¯¡£ÀýÈ磬Èç¹ûÄãÓÐÒ»¸öTextÊôÐÔֵΪ"Hello"µÄTextBox¿Ø¼þ£¬Ôò´ËʱÕâ¸öÊôÐÔ±»ÉèÖá£ÎÒÃÇÒ²¿ÉÒÔÔÚÕâÀﶯ̬µÄ´´½¨¿Ø¼þ¡£Õâ¸öʼþ½ö½ö·¢ÉúÔÚÒ³¼¶±ðµÄÀàÖУ¬Óû§¿Ø¼þºÍĸ°æҳûÓÐÕâ¸öʼþ¡£ÏÂÃæµÄ´úÂëʾÀýÁËÈçºÎÖØдÕâ¸ö·½·¨ÒÔÔö¼ÓÄãµÄ×Ô¶¨Òå´úÂëprotected override void OnPreInit(EventArgs e){//custom codebase.OnPreInit(e);}×¢Ò⣬ÎÒÃÇÖ»ÄÜÔÚPreInit()ʼþÖж¯Ì¬µÄÉèÖÃthemes£¬ÇÒÓ¦¸ÃÔÚPreInit()ʼþ»ò¸Ãʼþ֮ǰ¼ÓÔØĸ°æÒ³¡£ 2. OnInit()ÔÚÕâ¸öʼþÀÎÒÃÇÄܶÁ³ö¿Ø¼þµÄÊôÐÔ£¨ÔÚÉè¼ÆģʽÖÐÉèÖõģ©¡£µ«ÊÇÎÒÃDz»ÄܶÁ³öÓû§ÉèÖõÄÖµ£¬ÒòΪµÃµ½Óû§ÉèÖõÄÖµÊÇÔÚLoadPostData()ʼþ±»¼¤·¢Ö®ºó¡£²»¹ýÔÚÕâ¸öʼþÖÐÎÒÃÇ¿ÉÒԵõ½POSTÊý¾Ý£¬ÈçÏÂstring selectedValue = Request.Form[controlID].ToString(); 3. LoadViewStateÕâ¸öʼþ½ö½öÔڻط¢Ö®ºó±»¼¤·¢£¨IsPostBack == true£©¡£ÔÚÕâ¸öʼþÖÐruntime´ÓÒþ²ØÓòÖзֽâ³öview state²¢¼ÓÔص½ËùÓÐÆôÓÃÁËview stateµÄ¿Ø¼þ¡£ 4. LoadPostBackDataÕâ¸öʼþÒ²½ö½öÊÇÔڻط¢Ö®ºó±»¼¤·¢¡£ÔÚÕâ¸öʼþÀïʵÏÖÁËIPostBackDataHandler½Ó¿ÚµÄ¿Ø¼þ´ÓHTTPµÄPOSTÊý¾ÝÖеõ½Öµ¡£×¢Ò⣬textbox¿Ø¼þ²»ÄÜ´Óview stateÖлñµÃÖµ£¬¶øÊÇÔÚ´ËʼþÖдÓPOSTÊý¾ÝÖлñµÃÖµ¡£ËùÒÔ¼´Ê¹ÓÐЩ¿Ø¼þûÓÐÆôÓÃview state£¬Ö»ÒªËüʵÏÖÁËIPostBackDataHandler½Ó¿Ú¾Í¿ÉÒÔ´ÓHTTPµÄPOSTÊý¾ÝÖеõ½Öµ¡£ ÁíÒ»¸öÖØÒªµÄ֪ʶµãÊÇÈç¹ûÎÒÃÇÓÐÒ»¸öDropDownList¿Ø¼þ²¢¶¯Ì¬µÄ¸øËüÔö¼ÓһЩѡÔñÏÄÇôruntime½«²»Äܵõ½ÕâЩֵ³ý·ÇÆôÓÃÁËview state£¨¼´Ê¹¿Ø¼þ¼Ì³Ð×ÔIPostBackDataHandler½Ó¿Ú£©¡£Õâ¸öÔ­Òò¾ÍÊÇÔÚHTTPµÄPOSTÊý¾ÝÖеÄÿһ¸ö¿Ø¼þÖ»ÄÜÓÐÒ»¸öÖµ£¬²¢ÇÒPOSTÊý¾ÝÖеÄËùÓÐÖµ¶¼²»»á±»±£´æ£¬³ýÁËʹÓÃview state¡£ 5. Page_LoadÕâÊÇ×î³£Óõķ½·¨ÁË£¬¶øÇÒÊÇһЩ¿ª·¢ÐÂÊÖ·ÅÖÃËûÃÇ´úÂëµÄµÚÒ»¸öµØ·½£¬ÓÐЩÐÂÊÖÃÇÍùÍùÈÏΪÕâ¾ÍÊÇPageÀàµÚÒ»¸ö´¥·¢µÄ·½·¨¡£Õâ¸ö·½·¨ÊÇ»ìÏýÎÒÃÇPageÉú´æÖÜÆÚµÄ×ï¿ý»öÊ×Ö®Ò»¡£×¢Ò⣺Èç¹ûÒ³ÀïÓÐÈκÎÓû§¿Ø¼þµÄ»°£¬ÄÇôÓû§¿Ø¼þµÄLoad·½·¨½«ÔÚÒ³ÀàµÄLoad·½·¨Ö®ºó±»´¥·¢¡£³ýÁËInit()ºÍUnload()Ö®ÍâµÄËùÓÐʼþ¶¼ÊÇ´Ó×îÍâÃæµ½×îÀïÃæ±»¼¤·¢µÄ£¬ËùÒÔÒ³µÄPage_Load()Ö®ºó£¬Ò³ÄÚµÄÆäËü¿Ø¼þµÄLoad·½·¨²Å±»´¥·¢¡£ 6. Control Event Handlersʼþ´¦Àí£¨±ÈÈçÏñButton1_Click()Ö®ÀàµÄ£©ÊǶ¨ÒåÔÚASPXÒ³ÃæÖеģ¬ÓÐһЩ¿ª·¢ÈËÔ±ÈÏΪµ±µ¥»÷Ò»¸ö°´Å¥ºó»áÁ¢¼´³ö·¢Button_Click() £¬ËûÃÇ


Ïà¹ØÎĵµ£º

dz̸ASP.net°²È«±à³Ì

ÔÚWeb±à³Ì¹ý³ÌÖУ¬´æÔÚןܶలȫÒþ»¼¡£±ÈÈçÔÚÒÔÇ°µÄASP°æ±¾ÖУ¬CookieΪ·ÃÎÊÕߺͱà³ÌÕ߶¼ÌṩÁË·½±ã£¬²¢Ã»ÓÐÌṩ¼ÓÃܵŦÄÜ¡£´ò¿ªIEä¯ÀÀÆ÷£¬Ñ¡Ôñ“¹¤¾ß”²Ëµ¥ÀïµÄ“InternetÑ¡Ï¬È»ºóÔÚµ¯³öµÄ¶Ô»°¿òÀïµ¥»÷“ÉèÖÔ°´Å¥£¬Ñ¡Ôñ“²é¿´Îļþ”°´Å¥£¬ÔÚµ¯³öµÄ´°¿ÚÖУ¬¾Í»áÏÔʾӲÅÌÀï ......

ASP.NET


      ͨ¹ý SqlDataSource ¿Ø¼þ£¬¿ÉÒÔʹÓà Web ·þÎñÆ÷¿Ø¼þ·ÃÎÊλÓÚ¹ØϵÊý¾Ý¿âÖеÄÊý¾Ý¡£ÆäÖпÉÒÔ°üÀ¨ Microsoft SQL Server ºÍ Oracle Êý¾Ý¿âÒÔ¼° OLE DB ºÍ ODBC Êý¾ÝÔ´¡£Äú¿ÉÒÔ½« SqlDataSource ¿Ø¼þÓëÊý¾Ý°ó¶¨¿Ø¼þ£¨Èç GridView¡¢FormView ºÍ DetailsView ¿Ø¼þ£©Ò»ÆðʹÓã¬Óü«ÉÙ´úÂë»òÉõÖÁ² ......

ASP.NET µÝ¹é °ó¶¨TreeView

 Ê×ÏÈ¿´Êý¾Ý¿â±í½á¹¹£º
´úÂëÈçÏ£º
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.Htm ......

asp.net »ñÈ¡IPµÄÏà¹Ø֪ʶ

ASP.net »ñµÃ¿Í»§¶ËµÄIP£¬×î³£¼ûµÄÊÇʹÓÃÏÂÊö´úÂ룺
string user_IP = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
¶ÔÓÚÁ˽â´úÀí·þÎñÆ÷Çé¿öµÄÈË£¬ÎÒÃÇ»áÖªµÀ£¬Èç¹ûÓû§Ê¹ÓÃÁË´úÀí·þÎñÆ÷£¬ÉÏÊö´úÂë»ñµÃµÄÊÇ´úÀí·þÎñÆ÷µÄIPµØÖ·£»Èç¹ûÓû§Ê¹ÓÃÁ˶à¸ö´úÀí·þÎñÆ÷£¬ÔòÊǵ½´ï·þÎñÆ÷µÄ×îºóÒ»¸ö´úÀí· ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ