ASP.NET
¶þ¡¢Ïò ASP.NET ÍøÒ³Ìí¼Ó HTML ·þÎñÆ÷¿Ø¼þ
HTML ·þÎñÆ÷¿Ø¼þÊÇÄú¿ÉÒÔ¶ÔÆä½øÐÐÅäÖÃÒÔ±ã¿ÉÒÔʹÓ÷þÎñÆ÷´úÂë¶ÔÆä½øÐбà³ÌµÄ HTML ÔªËØ¡£
1¡¢ÈçºÎ£ºÊ¹Óà ASP.NET Óï·¨ÏòÍøÒ³Ìí¼Ó HTML ·þÎñÆ÷¿Ø¼þ
Ìí¼Ó HTML ·þÎñÆ÷¿Ø¼þºÍÌí¼ÓÈÎÒâ HTML ÔªËØÀàËÆ£¬²»Í¬Ö®´¦ÔÚÓÚÄúÐèÒª½«ÔªËØת»»Îª¿Ø¼þ£¬ÒÔ±ã¿ÉÒÔÔÚ·þÎñÆ÷´úÂëÖÐʹÓÃËü£¬¿ÉÒÔͨ¹ýÔÚ .aspx ÎļþÖÐÖ±½ÓÉùÃ÷ HTML ·þÎñÆ÷¿Ø¼þÏòÒ³ÖÐÌí¼ÓÕâÖֿؼþ¡£
Ìí¼Ó HTML ·þÎñÆ÷¿Ø¼þ
·¼üÈëÒªÓÃ×÷¿Ø¼þµÄÔªËØµÄ HTML Óï·¨¡£°üº¬¸ÃÔªËصij£¹æ HTML Óï·¨£¬ÁíÍâÇëÖ´ÐÐÒÔϲÙ×÷£º
·³ý·Ç¿Ø¼þÊǸ´ÔӿؼþµÄ×é³É²¿·Ö²¢ÇÒ½«Öظ´³öÏÖ£¨ÈçÔÚ Repeater¡¢DataList ºÍ GridView ¿Ø¼þÖУ©£¬·ñÔò½«¸Ã¿Ø¼þµÄ ID ÊôÐÔÉèÖÃΪ¶ÔÓÚ¸ÃҳΨһµÄÖµ¡£
·ÉèÖà runat="server" ÊôÐÔÒÔ½«ÔªËØת»»Îª¿Ø¼þ¡£
ÏÂÃæµÄʾÀýÑÝʾÈçºÎÉùÃ÷ HtmlInputText ¿Ø¼þ¡¢HtmlInputText ¿Ø¼þ¡¢HtmlInputButton ¿Ø¼þºÍ HtmlAnchor ¿Ø¼þ£º
<input id="Name" type="text" size="40" runat="server" />
<input type="submit" id="Enter" value="Enter" runat="server" />
Click <a id="Anchor1" runat="server" href="more.html">More </a> to see the next page.
2¡¢ÈçºÎ£º½« HTML ·þÎñÆ÷¿Ø¼þת»»Îª HTML ÔªËØ
Èç¹ûÄú²»ÔÙÐèÒªÔÚ·þÎñÆ÷´úÂëÖÐ¶Ô HTML ·þÎñÆ÷¿Ø¼þ±à³Ì£¬ÔòÓ¦½«Æäת»»Îª´¿ HTML ÔªËØ¡£Ò³ÖеÄÿ¸ö HTML ·þÎñÆ÷¿Ø¼þ¶¼Ê¹ÓÃ×ÊÔ´£¬Òò´Ë×îºÃ¾¡Á¿¼õÉÙ ASP.NET ÍøÒ³±ØÐëʹÓõĿؼþµÄÊýÄ¿¡£
½« HTML ·þÎñÆ÷¿Ø¼þת»»Îª HTML ÔªËØ
·´Ó¿Ø¼þ±ê¼ÇÖÐÒƳý runat="server" ÊôÐÔ¡£
·Äú²»±ØÒƳý ID ÊôÐÔ¡£Èç¹û´æÔÚÒýÓøÃÔªËصĿͻ§¶Ë½Å±¾£¬ÔòÎñÇëСÐÄ£¬Ç§Íò²»ÒªÒƳý ID ÊôÐÔ¡£
Ïà¹ØÎĵµ£º
ÔÚWeb±à³Ì¹ý³ÌÖУ¬´æÔÚןܶలȫÒþ»¼¡£±ÈÈçÔÚÒÔÇ°µÄASP°æ±¾ÖУ¬CookieΪ·ÃÎÊÕߺͱà³ÌÕ߶¼ÌṩÁË·½±ã£¬²¢Ã»ÓÐÌṩ¼ÓÃܵŦÄÜ¡£´ò¿ªIEä¯ÀÀÆ÷£¬Ñ¡Ôñ“¹¤¾ß”²Ëµ¥ÀïµÄ“InternetÑ¡Ï¬È»ºóÔÚµ¯³öµÄ¶Ô»°¿òÀïµ¥»÷“ÉèÖÔ°´Å¥£¬Ñ¡Ôñ“²é¿´Îļþ”°´Å¥£¬ÔÚµ¯³öµÄ´°¿ÚÖУ¬¾Í»áÏÔʾӲÅÌÀï ......
Ó¦ÓóÌÐò״̬Êǿɹ© ASP.NET Ó¦ÓóÌÐòÖеÄËùÓÐÀàʹÓõÄÊý¾Ý´¢´æ¿â¡£Ëü´æ´¢ÔÚ·þÎñÆ÷µÄÄÚ´æÖУ¬Òò´ËÓëÔÚÊý¾Ý¿âÖд洢ºÍ¼ìË÷ÐÅÏ¢Ïà±È£¬ËüµÄÖ´ÐÐËٶȸü¿ì¡£ÓëÌض¨ÓÚµ¥¸öÓû§»á»°µÄ»á»°×´Ì¬²»Í¬£¬Ó¦ÓóÌÐò״̬ӦÓÃÓÚËùÓеÄÓû§ºÍ»á»°¡£Òò´Ë£¬Ó¦ÓóÌÐò״̬ÓÃÓÚ´æ´¢ÄÇЩÊýÁ¿½ÏÉÙ¡¢²»ËæÓû§µÄ±ä»¯ ......
1. Êý¾Ý¿â·ÃÎÊÐÔÄÜÓÅ»¯
Êý¾Ý¿âµÄÁ¬½ÓºÍ¹Ø±Õ
·ÃÎÊÊý¾Ý¿â×ÊÔ´ÐèÒª´´½¨Á¬½Ó¡¢´ò¿ªÁ¬½ÓºÍ¹Ø±ÕÁ¬½Ó¼¸¸ö²Ù×÷¡£ÕâЩ¹ý³ÌÐèÒª¶à´ÎÓëÊý¾Ý¿â½»»»ÐÅÏ¢ÒÔͨ¹ýÉí·ÝÑéÖ¤£¬±È½ÏºÄ·Ñ·þÎñÆ÷×ÊÔ´¡£ASP.NETÖÐÌṩÁËÁ¬½Ó³Ø(Connection Pool)¸ÄÉÆ´ò¿ªºÍ¹Ø±ÕÊý¾Ý¿â¶ÔÐÔÄܵÄÓ°Ï졣ϵͳ½«Óû§µÄÊý¾Ý¿âÁ¬½Ó·ÅÔÚÁ¬½Ó³ØÖУ¬ÐèҪʱȡ³ö£¬¹Ø±ÕʱÊÕ»ØÁ¬½ ......
Èý²ã¼Ü¹¹(3-tier application) ͨ³£ÒâÒåÉϵÄÈý²ã¼Ü¹¹¾ÍÊǽ«Õû¸öÒµÎñÓ¦Óû®·ÖΪ£º±íÏֲ㣨UI£©¡¢ÒµÎñÂß¼²ã£¨BLL£©¡¢Êý¾Ý·ÃÎʲ㣨DAL£©¡£Çø·Ö²ã´ÎµÄÄ¿µÄ¼´ÎªÁË“¸ßÄÚ¾Û£¬µÍñîºÏ”µÄ˼Ïë¡£
1¡¢±íÏֲ㣨UI£©£ºÍ¨Ë×½²¾ÍÊÇÕ¹ÏÖ¸øÓû§µÄ½çÃ棬¼´Óû§ÔÚʹÓÃÒ»¸öϵͳµÄʱºòËûµÄËù¼ûËùµÃ¡£
2¡¢ÒµÎñ ......
Default.aspx CSÎļþ´úÂë
using System;
using System.Data;
using System.Configuration;
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.HtmlControls;
public partial class _De ......