ÇåÇå³þ³þasp.net ( Èý ) £ºViewState
ViewState¸ÅÊö
Ò³ÃæÔÚ³õʼ»¯µÄʱºò£¬asp.net»áÔÚÒ³ÃæÄÚ½¨ViewStateÊôÐÔ£¬ÎÒÃÇ¿ÉÒÔ½«ÐèÒª±£´æµÄÊý¾Ý·Åµ½ÊÓͼ״̬µÄ¼¯ºÏÖУ¬ÒÔ´ïµ½ÔÚÒ³Ãæ»Ø·¢µÄʱºò±£´æÊý¾ÝµÄÄ¿µÄ¡£
ʹÓÃViewStateÒÔÇ°£¬ÐèҪעÒâÒÔÏÂÄÚÈÝ£º
1.ViewStateÒÀÀµÓÚ×ֵ伯ºÏ¡£
2.ViewStateÖеÄÿһÏîͨ¹ýΨһµÄ×Ö·û´®Ãû×Ö½øÐÐË÷Òý¡£
ÎÒÃÇÔÚ¸øÊÓͼ¼¯ºÏµÄij¸öË÷ÒýÏֵµÄʱºò£¬Èç¹ûÊÓͼ¼¯ºÏÖдæÔÚ¸ÃË÷ÒýÏÔò¸³Öµ£»Èç¹ûûÓУ¬Ôò¸ÄË÷ÒýÏ»á±»×Ô¶¯Ìí¼Ó²¢¸³Öµ¡£
ÔÚ³¢ÊÔ´ÓÊÓͼ¼¯ºÏÖÐÈ¡³öij¸öË÷ÒýÏîµÄÖµµÄʱºò£¬Èç¹ûÊÓͼ¼¯ºÏÖв»´æÔÚ´ËË÷ÒýÏîµÄʱºò£¬½«»áÅ׳öÒì³£¡£
Òò´ËÎÒÃÇÔÚÈ¡ÖµµÄʱºò£¬Í¨³£»á¼Ó¸öÅжϡ£
ÀýÈ磺
´úÂë
if (ViewState["test"] != null)
{
int test = (int)ViewState["test"];
}
3.ViewState¿ÉÒÔ±£´æ¼òµ¥Êý¾ÝÀàÐͺÍ×Ô¶¨Òå¶ÔÏó¡£
4.ÈκÎͨ¹ýË÷Òý×Ö·û´®´ÓViewStateÖÐÈ¡³öÀ´µÄÊý¾Ý¶¼ÊÇObjectÀàÐÍ£¬ÎÒÃÇÐèÒªÏÔʽµÄ½«Æäת»»³ÉÐèÒªµÄÀàÐÍ£¬ÈçÉÏÀý¡£
ʹÓÃViewStateµÄÒ»¸öÀý×Ó
html
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br/>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br/>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox><br/>
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox><br/>
<asp:Button ID="Button1" runat="server" Text="Save" onclick="Button1_Click" />
<asp:Button ID="Button2" runat="server" Text="Restore" onclick="Button2_Click" />
<asp:Button ID="Button3" runat="server" Text="SaveWithDictionary" onclick="Button3_Click" />
Ïà¹ØÎĵµ£º
Page_Load--Ò³Ãæ¼ÓÔØʼþ.
Page.IspostBackÅжÏÊÇ·ñµÚÒ»´Î¼ÓÔØ¡£
ÿ´ÎÏìÓ¦·þÎñÐÅÏ¢(¼È¿Í»§ÇëÇóASP.NETÒ³Ãæ-ASPXÎļþ»òWeb·þÎñ-
ASMXÎļþ)¾Í¼ÓÔØÒ»´Î(Ö´ÐÐÒ»´ÎPage_Load)¡£
¼ÓÔصÄʱºò²¢²»ÊÇÿ´Î¶à±àÒëÒ»´Î´úÂëÎļþ£¬ÒòΪ£ºÃ¿Ò»´ÎÇëÇó
ASPXÎļþʱ²¢²»ÊǶàÒª½øÐÐÒ»´Î±àÒ룬¶øÊǵÚÒ»´ÎÖ´ ......
69.ÏÂÃæÕâ¶Î´úÂëÊä³öʲô£¿ÎªÊ²Ã´£¿
int i=5;
int j=5;
if (object.referenceequals(i,j))
console.writeline("equal");
else
console.writeline("not equal");
´ð£º²»ÏàµÈ£¬ÒòΪ±È½ÏµÄÊǶÔÏó
70.ʲô½Ð×ösql×¢È룬ÈçºÎ·ÀÖ¹£¿Çë¾ÙÀý˵Ã÷¡£
´ð£ºÀûÓÃsql¹Ø¼ü×Ö¶ÔÍøÕ¾½øÐй¥»÷¡£¹ýÂ˹ؼü×Ö'µÈ
71.ʲôÊÇ·´É䣿
´ð£º ......
Ö÷Ìå¼Ü¹¹
¡¡¡¡¸÷ƵµÀ·Ö±ðλÓÚ²»Í¬µÄWeb Project(¾ßÓжÀÁ¢µÄ¶þ¼¶ÓòÃû)£¬²¢½«ËùÓеÄÒµÎñÂß¼ÒÔ¼°Êý¾Ý·ÃÎʹ¦ÄÜ·â×°³ÉClass Library£¬ËùÓÐƵµÀ¹²ÓÃÕâ¸öClass Library¡£
¡¡¡¡ÏÂÃæÏêϸ½éÉÜʵÏÖ·½·¨¡£
¡¡¡¡¼ÙÉèÍøÕ¾ÓÐÈý¸öƵµÀ£¬ÐÂÎÅ¡¢ÂÛ̳ÒÔ¼°²©¿Í£¬¶ÔÓ¦µÄ¶þ¼¶ÓòÃûΪ"news"¡¢"forum"¡¢"blog"¡£³ ......
1 public partial class FileDownLoad : System.Web.UI.Page
2 {
3 //ÌṩÏÂÔصÄÎļþ£¬²»±àÂëµÄ»°ÎļþÃû»áÂÒÂë
&nb ......