WebÒ³ÃæÊÇÎÞ״̬µÄ£¬ ·þÎñÆ÷¶Ôÿһ´ÎÇëÇó¶¼ÈÏΪÀ´×Ô²»Í¬Óû§£¬Òò´Ë£¬±äÁ¿µÄ״̬ÔÚÁ¬Ðø¶ÔͬһҳÃæµÄ¶à´ÎÇëÇóÖ®¼ä»òÔÚÒ³ÃæÌøתʱ²»»á±»±£Áô¡£ÔÚÓÃASP.NET Éè¼Æ¿ª·¢Ò»¸öWebϵͳʱ£¬ Óöµ½Ò»¸öÖØÒªµÄÎÊÌâÊÇÈçºÎ±£Ö¤Êý¾ÝÔÚÒ³Ãæ¼ä½øÐÐÕýÈ·¡¢°²È«ºÍ¸ßЧµØ´«ËÍ£¬Asp.net ÌṩÁË״̬¹ÜÀíµÈ¶àÖÖ¼¼ÊõÀ´½â¾ö±£´æºÍ´«µÝÊý¾ÝÎÊÌ⣬ÒÔÏÂÀ´Ì½ÌÖ.NET ϵĽâ¾ö´ËÎÊÌâµÄ¸÷ÖÖ·½·¨ºÍ¸÷×ÔµÄÊÊÓó¡ºÏ¡£
1.1 ʹÓÃQuerystring ·½·¨
QueryString Ò²½Ð²éѯ×Ö·û´®£¬ ÕâÖÖ·½·¨½«Òª´«µÝµÄÊý¾Ý¸½¼ÓÔÚÍøÒ³µØÖ·(URL)ºóÃæ½øÐд«µÝ¡£ÈçÒ³ÃæA.aspx Ìøתµ½Ò³ÃæB.aspx£¬¿ÉÒÔÓÃRequest.Redirect("B.aspx?²ÎÊýÃû³Æ=²ÎÊýÖµ")·½·¨£¬Ò²¿ÉÒÔÓó¬Á´½Ó£º£¬Ò³ÃæÌøתºó£¬ÔÚÄ¿±êÒ³ÃæÖпÉÓÃRuquest["²ÎÊýÃû³Æ"]À´½ÓÊÕ²ÎÊý¡£Ê¹ÓÃQuerySting ·½·¨µÄÓŵãÊÇʵÏÖ¼òµ¥£¬ ²»Ê¹Ó÷þÎñÆ÷×ÊÔ´£»È±µãÊÇ´«µÝµÄÖµ»áÏÔʾÔÚä¯ÀÀÆ÷µÄµØÖ·À¸ÉÏ£¬Óб»´Û¸ÄµÄ·çÏÕ£¬²»ÄÜ´«µÝ¶ÔÏó£¬Ö»ÓÐÔÚͨ¹ýURL ÇëÇóҳʱ²éѯ×Ö·û´®²ÅÊÇ¿ÉÐеġ£
1.2 ÀûÓÃÒþ²ØÓò
Òþ²ØÓò²»»áÏÔʾÔÚÓû§µÄä¯ÀÀÆ÷ÖУ¬ Ò»°ãÊÇÔÚÒ³ÃæÖмÓÈëÒ»¸öÒþ²Ø¿Ø¼þ£¬ Óë·þÎñÆ÷½øÐн»»¥Ê±°ÑÖµ ......
ASP.Net ѧϰ֮·µ»ØÉÏÒ»Ò³µÄʵÏÖ·½·¨
[ÈÕÆÚ£º01-20] [×ÖÌ壺´ó ÖРС]
·µ»ØÉÏÒ»Ò³µÄÕâ¸ö¶«¶«ÔÚÎÒÃÇ×öÏîÄ¿µÄʱºòÒ»°ãÊÇÓÃÓÚÌîдÍê±íµ¥ºóÈ·ÈϵÄʱºò£¬ÓжÔÔÀ´ÊäÈëµÄÊý¾Ý½øÐÐÐÞ¸ÄʱÓõģ¬»òÕßÊÇÒòΪÍøվΪÁË·½±ãä¯ÀÀÕ߶øÓÐÐÄÌí¼ÓµÄÒ»¸ö¶«¶«£¬Ò»°ãÕâÖÖ¹¦ÄܵÄʵÏÖÔÚASP.netÖж¼ÊÇÓÃÒ»¸öbuttonµÄ¿Ø¼þÀ´ÊµÏֵģ¬ÊµÏֵķ½·¨Óкܶ࣬½ñÌìÇ¡ºÃÔÚ×öÏîĿʱÅöµ½ÒªÓÃÕâ¸ö¶«¶«£¬ÎҾͰÑÄÜʵÏÖ" ·µ»ØÉÏÒ»Ò³","·µ»ØÇ°Ò»Ò³"µÄ¼¸ÖÖ·½·¨×ܽáÁËһϣ¬¹©´ó¼Òѧϰ֮Óã¬Çë¶à¶àÖ¸½Ì:0)
ÆäʵҪʵÏÖÕâ¸ö¹¦ÄÜÖ÷Òª»¹ÊÇÒªÓõ½javascript
·½·¨Ò»£º
ÔÚasp.netµÄaspxÀïÃæµÄÔ´´úÂëÖÐ
<input type="button onclick="javascript:window.history.go(-1);"value="·µ»ØÉÏÒ»Ò³">
dzÎö£ºÕâ¸öÊÇÓÃÁËHTML¿Ø¼þ£¬Í¨¹ýÒ»¸öonclickµÄʼþ£¬µ÷ÓÃÁËjavascriptÖеÄÒ»¸ö·½·¨¾Í¿ÉÒÔÁË¡£Õâ¸öÊÇ×î¼òµ¥µÄÁË£¬Ò²Í¬ÑùÊÊÓÃÓÚ¾²Ì¬Ò³Ãæ,ASPÒ³ÃæµÈ¡£
·½·¨¶þ:
ÀûÓÃReponse.write
Èç¹ûÄã¶ÔASPÓÐÒ»¶¨µÄÁ˽⣬ÄÇô¶ÔResponse.writeÕâ¸ö¶«¶«¾Í²»»áÄ°ÉúÁË£¬·½·¨Ò»ÊÇÖ±½ÓÓÐHTMLÒ³ÃæÖÐʵÏÖ£¬ÔòÕâ¸öÔòÊÇÔÚºǫ́»·¾³ÖÐʵÏÖ£¨Õâ¸ö˵·¨ºÃÏñ²»ÊǺܹ淶£¬ºÇºÇ)
Response.write("<script language=ja ......
Ò³Ãæµ¼³öExcelʱ£¬³£ÓõÄÖ±½ÓRenderControlµÄ·½·¨£¬Èç¹û±í¸ñÖÐÓÐÊý×Ö£¬ÔÚExcelÖÐÍùÍù¸ñʽ»áÂÒ£¬±ÈÈçÇ°ÃæÓÐ0£¬µ«ÏÔʾ³öÀ´ºó0¶¼±»È¥µôÁË¡£
Òò´ËÒªÔÚ°ó¶¨Êý×ÖµÄʱºò£¬ÊÖ¶¯Ö¸¶¨Ò»Ï´ËÁеĸñʽ£¬ÈÃÊý×ÖÒÔÎı¾·½Ê½ÏÔʾ¾ÍÐÐÁË
protected void myGridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//ÈÃÊý×ÖÒÔÎı¾ÐÎʽ±íʾ
e.Row.Cells[4].Attributes.Add("style", "vnd.ms-excel.numberformat:@");
}
} ......
²¿ÃÅÒª×öÒ»¸öÍøÕ¾£¬ÎÒÒÔÇ°ÓõÄÊÇphp»òasp×öµÄ£¬Õâ»ØÏë¸ÄÓÃasp.net×ö£¬Ö÷Òª»ùÓÚÁ½µã¿¼ÂÇ£¬µÚÒ»£ºÏëͨ¹ýasp.netѧϰc#¼°Æä.net¿ò¼Ü¡£µÚ¶þ£º×Ô¼ºÓÖÏë͵ÀÁ£¬²»Ïë´ÓÍ·¿ªÊ¼×öÍøÕ¾£¬ÓÚÊǾÍÏëÓÿªÔ´µÄnetcmsÀ´¸Ä¸Ä¡£ÓÚÊÇÓÐÁËÎÒµÄϵÁÐÎÄÕ¡£¸ù¾ÝÎÒµÄѧϰ½ø¶ÈÎÒ»áÿÌì¸üУ¬ÇëÅóÓÑÃǹØ×¢¡£ ......
ÔÚBSÏîÄ¿ÖУ¬Ä³¸öaspxÒ³ÃæÐèÒªÒýÓÃÍⲿ½Å±¾Îļþ£¬Í¨¹ýÔÚÒ³Ãæhead½Ú<script language="" src="">·½Ê½ÒýÓÃÖ¸¶¨µÄjsÖ®ºó£¬ÈÔÈ»ÎÞЧ¡£Í¨¹ýalert·½Ê½µ÷ÊÔ£¬·¢ÏÖÊÇÓÉÓÚjsÎļþ±àÂëÓëjsÎļþÄÚÈݲ»·û¡£ÓÉÓÚjsÎļþÖаüº¬ÖÐÎÄ×¢ÊÍ£¬ËùÒÔÐèÒªÉèÖÃjsÎļþΪ¿Éʶ±ðÖÐÎĵÄgb2312±àÂë¡£Æä·½·¨ÔÚÍøÉÏÒ²½²Êö£¬ÒÔÏÂΪÍøÕªÄÚÈÝ£º
ÔÚ.netÖÐͨ¹ýÕâÖÖ·½Ê½ÒýÓÃjsÎļþ
<script type="text/javascript" src="setday0.js"></script>
È»ºóÔÚÒ³ÃæÖе÷ÓÃsetday0.jsÎļþÖеķ½·¨ÍùÍù»á³ö´í£¡µ«ÊÇÄãÈç¹û°Ñsetday0.jsÎļþµÄÄÚÈÝÖ±½Ó·Åµ½¸ÃÒ³ÃæÖÐÀ´ÓÖÒ»µãÎÊÌâҲûÓС£Õâ¸öÎÊÌâÀ§»óÁËÎҺܾã¬ÔÚ1.1µÄʱºò¾ÍÓöµ½Á˵±Ê±Ã»°ì·¨¾ÍÔÚÒ³ÃæÖÐÖØдjs´úÂë¡£½ñÌì²Å·¢ÏÖÁËÕâ¸öÎÊÌâµÄ½â¾ö°ì·¨¡£
Õâ¸öÎÊÌâÊÇÓÉÓÚ.netÖеÄtext±àÂëËùÒýÆðµÄ£¬ÎÒÃÇÐèÒª°Ñsetday0.jsÎļþ±£´æΪUTF-8»òÕßÆäËûUnicode±àÂ뷽ʽ£¬ÎÊÌâ¾ÍÓÈжø½â¡£ÔÀ´µÄÎı¾±àÂëΪgb2312£¬ÒòΪÆäÖÐÓкº×Ö¡£
ÈçºÎ½øÐбàÂëת»»£¿
1¡¢ÓüÇʱ¾´ò¿ª£¬±£´æµÄʱºòÑ¡ÔñUnicode±àÂ룻
2¡¢Ö±½ÓÔÚvsÖÐÑ¡ÔñÁí´æΪ£¬±£´æ°´Å¥ÓÒ±ßÓиöС¼ýÍ·£¬µãһϣ¬È»ºóÑ¡Ôñ±àÂë·½Ê ......
[תÌùÒ»]
ʹÓÃASP.NET MVC¿ò¼Ü£¬´´½¨Ä¬ÈÏÏîÄ¿£¬µÚÒ»Ö±¹Û¸Ð¾õ¾ÍÊǵØÖ·¶¼ÊÇRewrite¹ýµÄ¡£¶ÔÔ´ÂëºÍÅäÖÃÎļþÉÔ¼Ó·ÖÎö²»ÄÑ¿´³ö£¬MVCʹÓÃÁËhttpModulesÀ´À¹½ØµØÖ·ÇëÇ󣬾ßÌåÓõ½ÁËSystem.Web.RoutingÀà¿â£¨MVC2ÖУ¬MVC1ÔõôÓõÄÍü¼ÇÁË¡££©¶øÕⲿ·ÖÀà¿â±»°ü×°ÔÚ.NET Framework3.5 SP1ÖУ¬MVC2ÐèÒªSP1Ö§³ÖÒ²¾ÍÀíËùµ±È»ÁË¡£SP1ÌṩµÄSystem.Web.RoutingÀà¿â¿ÉÒÔ·½±ãµØ½øÐеØÖ·ÇëÇóÀ¹½Ø£¬¶Ô±àÂë´¦Àí·½ÃæÒ²ºÜÓÅÐã¡£UrlRoutingModuleÀàÀ¹½ØÇëÇó£¬ÔÚÕâ֮ǰ£¬Application_StartµÄʱºò£¬»á¸øRouteTableµÄÈ«¾Ö¶ÔÏóÒ»¸öÀ¹½ØµÄÉèÖ᣶øÕâ¸öÉèÖÃʹÓÃRouteCollection¶ÔÏó½øÐб£´æ£¬MVC¶ÔÕâ¸öÀà½øÐÐÁËÀ©Õ¹——RouteCollectionExtensions¡£ÕâЩ¿ÉÒÔ²»¿¼ÂÇ£¬½ÓÏÂÀ´£¬µ±Óû§·ÃÎÊÒ³Ãæʱ£¬UrlRoutingModuleÀàÀ¹½ØÇëÇó£¬ÔÚRouteTableÖв鿴ÊÇ·ñ·ûºÏ¹æÔò£¬·ûºÏµÄ»°£¬¾Í»áµ÷ÓÃMvcHandler£¬Õâ¸öµ÷ÓÃÔÚhttpHandlersÅäÖýڵ㱻ע²á£¬Ìõ¼þÊǵØÖ··ûºÏ“*.mvc”¹æÔò¡£MvcHandlerµÄProcessRequest·½·¨¾Í»áµ÷ÓÃControllerÀ´Ö´ÐС£ÊÂʵÉÏÕû¸ö¹ý³Ì¶¼ÊǺںÐ×Ó£¬Óû§¸Ð¾õ²»µ½¡£ÔÚControllerÖÐij·½·¨Ö´Ðк󣬷µ»Ø½á¹û£¬ÔÙ½øÈë¾ßÌåµÄaspxÒ³Ãæ¡£
·ÖÎöÁËMVCµÄ¹¤×÷¹¤³Ì£¬¾Í¿ÉÒÔ¶Ô±ÈÆäÓëWebFormµÄÇø±ðÁË ......