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

ASP.NetÖпؼþµÄEnableViewStateÊôÐÔ ¡¾×ªÔØ¡¿


ÔÚASP.NetÖжԸ÷¸öWebForm¿Ø¼þÒýÈëÒÔǰûÓеÄEnableViewStateÊôÐÔ¡£Õâ¸öÊôÐÔ¾¿¾¹ÓÐʲôÓá£ÎÒÃÇÖªµÀ¶ÔÓÚWebForm¶øÑÔ£¬Æä´úÂëÊÇÔÚ·þÎñÆ÷¶ËµÄ£¬ÒÔ´¦Àí¿Í»§¶ËµÄÇëÇó¡£µ±Óû§Í¨¹ýä¯ÀÀÆ÷ä¯ÀÀÍøÒ³µÄʱºò£¬»á¶ÔÍøÒ³½øÐÐijЩ²Ù×÷£¬±ÈÈç´ò¿ªÐÂÁ´½Ó£¬»òµ¥»÷ij¸ö°´Å¥¡£ÔÚASPÖУ¬ÕâЩÊÇͨ¹ý½Å±¾ÓïÑÔ¶ÔÆä½øÐд¦Àí£¬Ö®ºóÔÙ´«µÝ¸ø·þÎñÆ÷¶Ë¡£µ«ÊÇÔÚASP.NETÏ£¬ÓÉÓÚ²ÉÓÃÁËcode behind¼¼Êõ£¬ÔÚcodingµÄʱºò£¬Í¨³£Êǽ«ÒÔÇ°¿Í»§¶ËÍê³ÉµÄ¹¤×÷·Åµ½ÁË·þÎñÆ÷¶Ë¡£
ÄÇô£¬·þÎñÆ÷ÊÇÔõô֪µÀ¿Í»§µÄ²Ù×÷µÄÄØ£¿±ÈÈçÎÒÔÚÎı¾¿òÊäÈëµÄÄÚÈÝ£¬»òÕßµ¥»÷Á˵Ǽ°´Å¥£¬·þÎñÆ÷¶ËÊÇÔõÑùµÃµ½ÕâЩÐÅÏ¢µÄÄØ£¿ÒòΪûÓÐÕâЩÐÅÏ¢£¬·þÎñÆ÷¶Ë¾ÍÎÞ·¨ÏìÓ¦¿Í»§µÄÇëÇó¡£Ô­Àí¾ÍÊÇASP.NETÒýÓÃÁËviewstateµÄ»úÖÆ¡£ÔÚ·þÎñÆ÷¶Ë±£´æÁËÍøÒ³¸÷¸ö¿Ø¼þ¼°Ò³ÃæµÄ״̬£¬ÕâÆäÖаüÀ¨¸÷¸ö¿Ø¼þÔÚÒ³ÃæÉϵIJ¼¾Ö£¬ºÍËûÃǸ÷×ÔµÄÊôÐÔ¡£ÕâЩֵ¾Í±£´æÔÚViewStateÏ¡£ÎÒÃÇ¿ÉÒÔ¹Û²ìAspxÒ³ÃæµÄhtmlÔ´´úÂ룬¼ÙÉèÕâ¸öÒ³ÃæÉÏÓÐÒ»¸öbutton°´Å¥£¬ºÍÒ»¸ölistBox¿Ø¼þ£¬htmlÎļþÈçÏ£º
<input type="hidden" name="__VIEWSTATE" value="dDwzODYzNDM5NTU7Oz7FvviJbq45bDa7QJaumIiOhZ8mOQ==" />
 <input type="submit" name="Button1" value="Button" id="Button1" style="height:40px;width:96px;Z-INDEX: 101; LEFT: 200px; POSITION: absolute; TOP: 240px" />
 <select name="ListBox1" size="4" id="ListBox1" style="width:152px;Z-INDEX: 102; LEFT: 176px; POSITION: absolute; TOP: 120px"></select>
ÎÒÃÇËüµÄ²»Í¬Ö®´¦£¬Ò»ÊÇÉÙÁËÒÔÇ°Ëù±ØÐëÏìÓ¦¿Í»§¶ËʼþµÄ½Å±¾ÓïÑÔ£¬Ò»ÊǶàÁËÒ»¸öÃûΪ”_VIEWSTATE”µÄÊôÐÔ¡£ÆäÖµÊÇÒ»³¤´®×Ö·û¡£ÀàÐÍΪ“hidden”¡£Õâ¸öÖµ¼Ç¼µÄ¾ÍÊǸ÷¸ö¿Ø¼þºÍÒ³ÃæµÄ״̬ÐÅÏ¢¡£µ±Óû§¶ÔÒ³Ãæ½øÐÐÏà¹Ø²Ù×÷µÄʱºò£¬×´Ì¬Öµ·¢Éú¸Ä±ä£¬²¢½«¸Ä±äµÄÖµ´«µÝ¸ø·þÎñÆ÷¶Ë¡£·þÎñÆ÷¶ËÔڱȽϸıäºóµÄ״ֵ̬ºÍ³õʼֵ֮¼äµÄÇø±ð£¬ÒÔÏìÓ¦¾ßÌåµÄÇëÇó¡£
Ò»µ©Ò³ÃæµÄ¿Ø¼þºÜ¶à£¬ÕâÖÖƵ·±µÄ´«µÝ¿Ø¼þ״ֵ̬¶ÔÍøÂçµÄÏûºÄÊǺܴóµÄ£¬Òò´Ë£¬ASP.NetÌṩÁËEnableViewStateÊôÐÔ£¬ÏµÍ³Ä¬ÈϵÄֵΪtrue¡£µ±ÉèÖÃΪtrueʱ£¬ÔÚ´«µÝ״ֵ̬ʱ¾Í°üÀ¨¸Ã¿Ø¼þ£»Èç¹ûÉèÖÃΪfalse£¬Ôò´«µÝ״ֵ̬ʱÔò²»°üÀ¨Ëü¡£¼ÈȻ״ֵ̬²»°üÀ¨¸Ã¿Ø¼þ£¬Ôò¿Í»§¶Ë¶ÔËü½øÐеIJÙ×÷£¬·þÎñÆ÷¶ËÊDz»ÏìÓ¦µÄ¡£
ÎÒÃÇ¿ÉÒÔ×ö¸öʵÑ飬ÔÚButton1_ClickʼþÖУ¬±àд´úÂ룺
ListBox.Items.Add(”¿Í»§¶Ëµã»÷°´Å¥Ò»´Î£¡”);
´ËÊ


Ïà¹ØÎĵµ£º

asp.net¿ØÖÆÍøÕ¾·Ö±æÂÊ

¿ØÖÆÍøÕ¾·Ö±æÂÊ ÎÒÃÇ¿ÉÒÔ Óà frameset
ËäÈ» asp.net²»Ö§³ÖÕâ¸öÊôÐÔ µ«Êǹ¦ÄÜÊÇ¿ÉÒÔʵÏÖµÄ
Èç £º
<frameset name="main" rows="105,*" frameborder="no" border="0" framespacing="0">
  <frame src="xx.aspx" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" /> ......

ASP.NET"ÕýÔÚÖÐÖ¹Ïß³Ì"´íÎóÔ­Òò

PRB£ºÔÚʹÓà Response.End¡¢Response.Redirect »ò Server.Transfer ʱ³öÏÖ ThreadAbortException
Ö¢×´
Èç¹ûʹÓà Response.End¡¢Response.Redirect »ò Server.Transfer ·½·¨£¬½«³öÏÖ ThreadAbortException Òì³£¡£Äú¿ÉÒÔʹÓà try-catch Óï¾ä²¶»ñ´ËÒì³£¡£
Ô­Òò
Response.End ·½·¨ÖÕÖ¹Ò³µÄÖ´ÐУ¬²¢½«´ËÖ´ÐÐÇл»µ½Ó¦ÓóÌÐò ......

ʹÓÃasp.net mvc ´´½¨Ò»¸öblog·¢²¼ÏµÍ³

 
ÎÒÊÔ×ÅȥʹÓÃasp.net mvcÄ£°åÈ¥´´½¨Ò»¸öblog·¢²¼ÏµÍ³¡£µ±È»£¬ÍøÉÏÓкܶàopen sourceµÄÄã¿ÉÒÔʹÓã¬ÌرðÊǺܶàphpдµÄÄ£°å¡£
ÕâÀïÖ»ÊÇÈ¥ÊÔ×ÅѧϰʹÓÃasp.net mvcÄ£°åÈ¥´´½¨Ò»¸öblog·¢²¼ÏµÍ³£¬ÎÒ×Ô¼ºÓᣴ󲿷ֵÄblog¶¼»áÓÐÈçÏÂһЩ²¿·Ö×é³É£º
ÕâÀﻹ»áʹÓÃCommon Library .net Õâ¸öopen sourceµÄproject¡£Äã¿ÉÒÔµ½ ......

Asp.Net ¼òµ¥¿¼Ìâ¹ÜÀíϵͳ


default.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls. ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ