asp.netÒ³ÃæÉúÃüÖÜÆÚÒ²³ÆÖ´ÐÐ˳Ðò
1.¶ÔÏó³õʼ»¯£¨OnInit·½·¨£©
Ò³ÃæÖеĿؼþ(°üÀ¨Ò³Ãæ±¾Éí)¶¼ÊÇÔÚËüÃÇ×î³õµÄFORMÖб»Ê״γõʼ»¯µÄ¡£Í¨¹ýÔÚASPXÒ³ÃæµÄºǫ́´úÂëÎļþµÄ¹¹ÔìÆ÷ÖÐÉùÃ÷ÄãµÄ¶ÔÏó£¬Ò³Ã潫֪µÀ¶ÔÏóµÄÀàÐÍ£¬²¢ÖªµÀÐèÒª´´½¨¶àÉÙ¸öÕâÑùµÄ¶ÔÏó¡£Ò»µ©ÄãÔÚ¹¹ÔìÆ÷ÖÐÉùÃ÷ÁËÄãµÄ¿Ø¼þ£¬Äã¾Í¿ÉÒÔÔÚËüµÄÈκÎ×ÓÀ࣬·½·¨£¬Ê¼þ»òÕßÊôÐÔÖзÃÎʵ½ËüÃÇ¡£µ«ÊÇ£¬Èç¹ûÄãµÄÈκζÔÏóÊÇÔÚASPXÎļþÖÐÖ¸¶¨µÄ¿Ø¼þ£¬ÕâÑùµÄ¿Ø¼þÊÇûÓÐÊôÐԵġ£¶øÇÒÕâÑù×ö¶Ô´Ó´úÂëÖзÃÎÊËüÃÇÊÇΣÏյģ¬ÒòΪÎÞ·¨±£Ö¤ÕâЩ¿Ø¼þʵÀýÊÇ°´ÕÕÔõÑùµÄ˳Ðò±»´´½¨µÄ(¼Ù¶¨ËüÃǶ¼ÊÇÄÜÍêÈ«±»´´½¨µÄ)¡£³õʼ»¯Ê¼þ¿ÉÒÔͨ¹ýOnInit·½·¨ÖØÔØ¡£
2.¼ÓÔØÊÓͼ״̬Êý¾Ý£¨LoadViewStateʼþ£©
³õʼ»¯ÒԺ󣬿ؼþ½öÄÜͨ¹ýIDÒýÓÃ(»¹Ã»Óн¨Á¢ÓÃÓÚÏà¶ÔÒýÓõÄÎĵµ¶ÔÏóÄ£ÐÍ)¡£ ÔÚLoadViewStateʼþÖУ¬Òѳõʼ»¯µÄ¿Ø¼þ»ñµÃµÚÒ»¸öÊôÐÔ£ºÉÏÒ»´ÎÌá½»´æÁôµ½·þÎñÆ÷µÄÊÓͼ״̬ÐÅÏ¢¡£Ò³ÊÓͼ״̬ͨ¹ýASP.NETά»¤£¬Ëü±»ÓÃÓÚÔÚÒ»¸öÍù·µÐгÌÖдæÁôÐÅÏ¢µ½·þÎñÆ÷¡£ÊÓͼ״̬ÐÅÏ¢±»±£´æΪһ¸öÃû³Æ/Öµ¶Ô£¬Ëü°üº¬¿Ø¼þµÄÈçTextºÍValueÒ»ÀàµÄÐÅÏ¢¡£ÊÓͼÐÅÏ¢±»±£´æÔÚÒþ²Ø<input>¿Ø¼þµÄÖµÊôÐÔÖÐÔÚÒ³ÇëÇóÖд«µÝ¡£ÕýÈçÄãËùÁ˽âµÄ£¬ÕâÊǾɵÄASP3.0״̬ά»¤¼¼ÊõµÄÒ»¸ö¾Þ´ó·ÉÔ¾¡£Õâ¸öʼþ¿ÉÒÔͨ¹ýLoadViewState·½·¨ÖØÔØ£¬ÍùÍùÓÃÀ´Ôڿؼþ±»Ìî³äʱ¶¨ÖÆËüËù½ÓÊܵÄÊý¾Ý¡£
3.´¦Àí»Ø´«Êý¾Ý£¨LoadPostDataʼþ£©
ÔÚ´´½¨Ò³µÄ½×¶Î£¬±»·¢Ë͵½·þÎñÆ÷¶ËµÄFormÊý¾Ý(ASP.NETÖеÄÊõÓïΪ»Ø´«Êý¾Ý)ÒÀÕÕÿ¸ö¿Ø¼þµÄÊý¾ÝÐèÇó½øÐд¦Àí¡£µ±Ò³ÃæÌá½»Formʱ£¬¿ò¼Ü½«ÔÚÿ¸öÌá½»Êý¾ÝµÄ¿Ø¼þÉÏʵÏÖIPostBackDataHandler½Ó¿Ú¡£Ò³ÃæÈ»ºó¼¤·¢LoadPostDataʼþ£¬Í¨¹ýÒ³Ãæ½âÎö·¢ÏÖʵÏÖÁËIPostBackDataHandler½Ó¿ÚµÄ¿Ø¼þ£¬²¢ÓÃÕýÈ·µÄ»Ø´«Êý¾Ý¸üпؼþ״̬¡£ASP.NETͨ¹ýÆ¥Åä¿Ø¼þµÄΨһ±êʾ·ûÀ´¸üÐÂÕýÈ·µÄ¿Ø¼þ£¬¸Ã±êʾ·û¾ßÓÐÃû³ÆÖµ¼¯ºÏÖеÄÃû³ÆÖµ¶Ô¡£ÕâÒ²¾ÍÊÇÔÚËùÓÐÌض¨µÄÒ³ÖÐÿ¸ö¿Ø¼þ¶¼ÐèÒªÒ»¸öΨһ±êʾ·ûµÄÔÒòÖ®Ò»¡£ÆäËüµÄ²½Ö趼ÓÉ¿ò¼ÜÀ´Íê³É£¬ÒÔÈ·¶¨Ã¿¸ö±êʾ·ûÔÚ»·¾³ÖÐÊÇΨһµÄ£¬ÀýÈç´æÔÚÓÚµ¥Ò³ÃæÖеÄ×Ô¶¨ÒåÓû§¿Ø¼þ¡£LoadPostDataʼþ±»¼¤·¢ºó£¬RaisePostDataChangedʼþ¾Í¿ÉÒÔËæʱ±»Ö´ÐÐÁË¡£
4.¶ÔÏó¼ÓÔØ£¨OnLoad·½·¨£©
¶ÔÏóÔÚLoadʼþÖлñµÃÕýÈ·µÄForm¡£ËùÓеĶÔÏóÊ×Ïȶ¼±»×éÖ¯ÔÚÒ³DOM(ASP.NETÖгÆΪ¿Ø¼þÊ÷)ÖУ¬²¢ÇÒºÜÈÝÒ×ͨ¹ý´úÂë»òÕßÏà¶ÔλÖÃ(crawling the DOM)À´ÒýÓá
Ïà¹ØÎĵµ£º
ÈçºÎÔÚ¿Í»§¶ËÖ±½Óµ÷ÓÃWebServiceÖеķ½·¨£¿
ÕâÀï½áºÏ¾Ñé×Ô¼ºÐ´Ò»Ð´
1.Ê×ÏÈн¨Ò»¸ö ASP.NET AJAX-Enabled Web Site,ÕâÑùϵͳΪÎÒÃÇ×Ô¶¯ÅäÖúÃÁË»·¾³£¬ÕâÖ÷ÒªÌåÏÖÔÚWeb.configÕâ¸öÎļþÉÏ£¬Èç¹ûÒÑÓÐÍøÕ¾²»ÊÇASP.NET AJAX-Enabled Web SiteÒ²¿ÉÒÔ¶ÔÕÕÐÞ¸ÄÏÂWeb.config£¬Ò²¿ÉÒÔ´ïµ½ÏàͬµÄЧ¹û¡£
2.н¨Ò»¸öweb·þÎñ£¬WebSer ......
1.¼òµ¥ÑéÖ¤
ÔÚASP.Net MVCÖУ¬ÑéÖ¤ÊÇÔÚController²ã£¬¶ø´íÎó³ÊÏÖÊÇÔÚView²ã£¬Controller²ãÊÇͨ¹ýModelStateÊôÐÔ½øÐÐÑéÖ¤µÄ,ModelStateµÄ״̬ÊÇͨ¹ýAddModelError()·½·¨½øÐÐ Ìí¼ÓµÄ¡£
¶øÔÚView²ã£¬ÊÇͨ¹ýHtmlµÄ¸¨Öú·½·¨½øÐгÊÏֵģ¬ÕâÁ½¸ö¸¨Öú·½·¨·Ö±ðÊÇ
Html.ValidationMessage()
Html.ValidationSummary()
Controller ......
JSON Serialization and Deserialization in ASP.Net
I was looking around for a simple example which would just do an object serialization to a JSON format, and then deserializing back to the original object. I found few examples on MSDN, but did seem to be too long ......
using (con)
{
con.Open();
String sqltext = "select * from emp where empno=@empno";
......
×÷Õߣº°½Ê¿Î°
ÔÚFedora 12Éϵݲװ¹ý³Ì
Ò»¡¢mono°²×°
yum install gcc gcc-c++ bison pkgconfig glib2-devel gettext make libgdiplus Cairo
wget http://ftp.novell.com/pub/mono/sources/mono/mono-2.6.1.tar.bz2
tar jxvf mono-2.6.1.tar.bz2
cd mono-2.6.1
./configure --prefix=/usr
make
make install
°²×° ......