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(”¿Í»§¶Ëµã»÷°´Å¥Ò»´Î£¡”);
´ËʱÔ
Ïà¹ØÎĵµ£º
ģ̬´°¿Úÿ´ÎÒ³ÃæÖØдò¿ª²»Ë¢Ð¡£
»º´æµÄÔÒò£¬¸Ä³ÉÕâÑù£º
½â¾ö°ì·¨¡£¡£¡£
url = frmWin + "? " + Math.random();
window.showModalDialog(url,me, 'dialogWidth= '+width + 'px;dialogHeight= '+height+ 'px;help:no;status:no;resizable:no;scro ll:no; ......
Ö»ÓÐÔÚ¡òPageÖ¸ÁîÖÐÉèÖÃÁË£ºAutoEventWireup="true"£¬·þÎñÆ÷¶ËµÄ±àÒëÆ÷½«°´ÕÕ Page_eventname ·½·¨ÃûµÄÐÎʽ×Ô¶¯µÄ¼ì²éÏàӦʼþ´¦Àí·½·¨£¬×Ô¶¯ÊµÏÖʼþµÄ¶©ÔÄ¡£
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System ......
1. ¼òÊö private¡¢ protected¡¢ public¡¢ internal ÐÞÊηûµÄ·ÃÎÊȨÏÞ¡£
´ð . private : ˽ÓгÉÔ±, ÔÚÀàµÄÄÚ²¿²Å¿ÉÒÔ·ÃÎÊ¡£
protected : ±£»¤³ÉÔ±£¬¸ÃÀàÄÚ²¿ºÍ¼Ì³ÐÀàÖпÉÒÔ·ÃÎÊ¡£
public : ¹«¹²³ÉÔ±£¬ÍêÈ«¹«¿ª£¬Ã»ÓзÃÎÊÏÞÖÆ¡£
internal: ÔÚͬһÃüÃû¿Õ¼äÄÚ¿ÉÒÔ·ÃÎÊ¡£
2 .ÁоÙASP.NET Ò³ÃæÖ®¼ä´« ......
ÔÙWindows XPÉÏдºÃµÄASP.NETÓ¦ÓóÌÐò²¿Êðµ½IISÉÏ,Á¬½Ó²»ÉÏOracle10gÊý¾Ý¿â,Ìáʾ£º
System.Data.OracleClient Requires oracle client software version 8.1.7 or greater¡£
ÒòΪÔÚµ÷ÊÔ»·¾³ÊÇ¿ÉÒÔÁ¬½ÓÉϵÄ,ËùÒÔ¿¼ÂÇ¿ÉÄÜÊÇIISȨÏÞÉèÖÃÎÊÌâ¡£
ÊÔ׎«ASP.NETÓû§Ìí¼Óµ½ÁËAdministrator×éÖС£½á¹ûÁ¬½Ó³É¹¦¡£ ......
Õâ¸ö¶«Î÷Ì«¾À½áÁË~Ìù³öÀ´´úÂ룬¹©´ó¼ÒÏíÓÃ
·ÖÈý¸ö²¿·Ö£º.config .aspx .aspx.cs
//web.config
<appSettings>
<add key="keystring" value="Data Source=ZRQ-PC;Initial Catalog=OnlineJudge;Integrated Security=True"/>
</appSettings>
......