[ת]ASP.NET¶àƵµÀÍøÕ¾¼Ü¹¹ÐĵÃ
asp.net¶àƵµÀÍøÕ¾¿ª·¢¼Ü¹¹Ç³Îö http://www.cnblogs.com/Kenny-Jiang/archive/2007/07/31/837900.html ±³¾°£º
ÎÒÃÇ´ò¿ªÃÅ»§Íøվʱ£¬ÍùÍù»á¿´µ½ºÜ¶àÅÅÁнôÃܵÄƵµÀÁÐ±í£¬Èç¡°ÐÂÎÅ¡±¡¢¡°²Æ¾¡±¡¢¡°ÓéÀÖ¡±µÈ¡£ÆµµÀΪÍøÕ¾ÌṩÁË·½±ãµÄµ¼º½¹¦ÄÜ¡£
ÄÚÈÝÃèÊö£º
±¾ÎÄÖ÷ÒªÌÖÂÛÔÚasp.net¿ò¼ÜÏÂʵÏÖ¶àƵµÀÍøÕ¾¼Ü¹¹µÄ¼¸ÖÖ·½°¸£¬²¢´Ó´úÂëÖØÓÃÐÔ¡¢¿ª·¢·½Ê½¡¢²¿Êð·½Ê½µÈ¼¸¸ö·½ÃæÀ´¶Ô¸÷·½°¸½øÐзÖÎö¡¢±È½Ï¡£
֪ʶ׼±¸£º
±¾ÎÄÖÐÌáµ½µÄ¸÷¼Ü¹¹·½°¸¾ù»ùÓÚMVC(Model-View-Controller)ģʽ£¬¶Ô¸ÃģʽÖи÷×é³É²¿¼þ×÷Èçϼò¶ÌÃèÊö£º
Model£º°üº¬ÒµÎñÂß¼²Ù×÷ÒÔ¼°Êý¾Ý·ÃÎʲÙ×÷;
View£º°üº¬UI´¦ÀíÏà¹Ø²Ù×÷;
Controller£º¿ØÖƲ¢Ðµ÷ViewÓëModelµÄ´¦Àí¹ý³Ì ¸÷·½°¸±È½Ï£º
·½°¸ ¼Ü¹¹ÃèÊö ´úÂëÖØÓÃÐÔ ¿ª·¢·½Ê½ ²¿Êð·½Ê½ ·½°¸Ò» ΪÕû¸öÍøÕ¾½¨Á¢Ò»¸öWeb Project¡£
ÿ¸öƵµÀ¶ÔÓ¦ÓÚWeb ProjectÖеÄÒ»¸öĿ¼£¬ÓеãÀàËÆÓÚASPµÄ´¦Àí·½Ê½¡£
Model²¿¼þ¼È¿ÉÒÔ°üº¬ÓÚWeb ProjectÖУ¬Ò²¿ÉÒÔ·â×°³ÉClass Library¡£ ½«Model²¿¼þ·â×°³ÉClass Libraryºó½«»ñµÃ½Ï¸ßµÄÖØÓÃÐÔ¡£ Ä£¿é½ÏΪ¼¯ÖУ¬¿ª·¢½ÏΪ¿ì½Ý£¬µ«²»Êʺϴó¹æÄ£Ð×÷¿ª·¢¡£ Ä£¿é½ÏΪ¼¯ÖУ¬²¿Êð±È½Ï·½±ã£¬µ«Ò»¸öСµÄBUG¿ÉÄܻᵼÖÂÕû¸öÍøÕ¾µÄ̱»¾¡£ ·½°¸¶þ Ϊÿ¸öƵµÀ½¨Á¢Ò»¸öWeb Project¡£
ÿ¸öƵµÀµÄModel²¿¼þ¼È¿ÉÒÔ°üº¬ÓÚÏàÓ¦µÄWeb ProjectÖУ¬Ò²¿ÉÒÔ·Ö±ð·â×°³ÉClass Library¡£ ÿ¸öModel²¿¼þ¶¼Ó¦ÓÃÓÚÌض¨µÄƵµÀ£¬´úÂë·ÖÉ¢£¬ÖØÓÃÐԽϵ͡£ ¸÷Ä£¿é½Ï¶ÀÁ¢£¬Êʺϰ´ÕÕ¹¦ÄÜÄ£¿é·ÖÅäÈÎÎñµÄ¿ª·¢·½Ê½¡£ ¸÷Ä£¿é¶ÀÁ¢£¬²¿Êð¹¤×÷·Ç³£·±¸´£¬µ«ÓÉÓÚ¸÷ƵµÀÊÇËÉñîºÏµÄ(ÉõÖÁ¿ÉÒÔλÓÚ²»Í¬µÄ·þÎñÆ÷)£¬Ò»¸öƵµÀµÄ¹ÊÕϲ»»áÓ°Ïìµ½ÆäËûƵµÀµÄÕý³£ÔËÐС£ ·½°¸Èý Ϊÿ¸öƵµÀ½¨Á¢Ò»¸öWeb Project¡£
ËùÓÐƵµÀµÄModel²¿¼þ·â×°³ÉÒ»¸ö¹²ÓõÄClass Library¡£ ËùÓÐƵµÀ¹²ÓÃÒ»¸öModel²¿¼þ£¬´úÂë½ÏΪ¼¯ÖУ¬¾ßÓкܸߵ
Ïà¹ØÎĵµ£º
µ±Ò»¸öÍøÒ³ÖмÈÓÐÊý¾ÝÑéÖ¤¿Ø¼þ£¬ÓÖÓÐÒ»¸ö°´Å¥ÔÚµã»÷ʱ³öÏÖÌáʾ°´Å¥¡£
Èç¹ûÖ±½ÓÔÚÒ³ÃæµÄºǫ́´úÂëµÄPage_Loadº¯ÊýÖÐдÈëbtn.Attributes["Onclick"] = "return confirm('È·¶¨Òª±£´æÊý¾Ý£¿')"£¬ÄÇôÑéÖ¤¿Ø¼þ¾Í»áʧЧ£¬ÒòΪÑéÖ¤¿Ø¼þÒ²ÊÇͨ¹ýjsʵÏֵģ¬ÕâÑùµÄ»°return confirm('È·¶¨Òª±£´æÊý¾Ý£¿')ÏÈÓÚÔÀ´µÄjs´úÂëÖ´ÐУ¬Ì ......
1. ´ò¿ªÐµĴ°¿Ú²¢´«ËͲÎÊý£º
´«ËͲÎÊý£º
response.write("£¼script£¾window.open('*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"')£¼/script£¾")
½ÓÊÕ²ÎÊý£º
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
2.Ϊ°´Å¥Ìí¼Ó¶Ô»°¿ò
Button1.Attributes. ......
Ê×ÏÈÎÒºÜÒź¶µÄ¸æËß´ó¼Ò£¬ÒòΪ΢ÈíµÄ͵ÀÁ£¬Ä¿Ç°UpdatePanel»¹²»Ö§³ÖÎļþÉÏ´«¡£±äÏàµÄ½â¾ö°ì·¨¾ÍÊÇUpdatePanelÖÐÉèÖÃPostBackTrigger£º
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:FileUpload ID="FileUpload1" runat="serv ......
ASP.NETÖ¸ÁîÔÚÿ¸öASP.NETÒ³ÃæÖж¼ÓС£Ê¹ÓÃÕâЩָÁî¿ÉÒÔ¿ØÖÆASP.NETÒ³ÃæµÄÐÐΪ¡£ÏÂÃæÊÇPageÖ¸ÁîµÄÒ»¸öÀý×Ó£º
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"
Inherits="_Default" %>
ÔÚASP.NETÒ³Ãæ»òÓû§¿Ø¼þÖÐÓÐ11¸öÖ¸Áî¡£ÎÞÂÛÒ³ÃæÊÇʹÓúǫ́±àÂëÄ£ÐÍ»¹ÊÇÄÚÖñ ......
»ñÈ¡ ASP.NET ÌṩµÄµ±Ç° Session ¶ÔÏó ( HttpSessionState Àà )¡£¸ÃÊôÐÔÌṩÓйص±Ç°ÇëÇóµÄ»á»°µÄÐÅÏ¢¡£Îª´Ó ASP.NET Ó¦ÓóÌÐòÇëÇóÒ³»òÎĵµµÄÿ¸öÓû§Î¬»¤Ò»¸ö Session ¶ÔÏó¡£µ±Óû§ÔÚÓ¦ÓóÌÐòÖдÓÒ»Ò³Òƶ¯µ½Áíһҳʱ£¬´æ´¢ÔÚ Session ¶ÔÏóÖеıäÁ¿²»»á±»·ÅÆú£»Ïà ......