Asp.Net 4.0 ÐÂÌØÐÔ ÏµÁÐ Ö®Ò» ´ÓÒ³Ãæ±ê¼Ç˵Æð
VS2010ÔÚ4Ô·ÝÒѾÕýʽ·¢²¼ÁË£¬Asp.Net 4.0¸øÎÒ´øÀ´ÁËһЩеĶ«Î÷¡£ÌåÑéÒ»°Ñ¡£
1. ´ÓÒ³Ãæ±ê¼Ç<%%>˵Æð
2. Asp.Net 4.0 ÖпÉÒÔÓÃ×Ô¶¨ÒåµÄProvider×öOutputCache ÁË
3. SEOÔöÇ¿Ö§³ÖMetaKeywords£¬ºÍMetaDescription£¬RedirectPermanant
4. SEOÔöÇ¿Ö®URL Routing
5. Êä³ö¸ü´¿¾»µÄHtml´úÂ룬ViewStateModeºÍClientIDMode,CheckBoxListµÈ
6. Asp.Net 4.0 ·á¸»µÄͼ±í¿Ø¼þ
7. ÔÚAsp.Net4.0ÖÐʹÓÃJqueryµÄAjax
8. ×Ô¶¯²¿Êð¹¦ÄÜÔöÇ¿
ÔÚAsp.Net4.0ÖÐ<%·ûºÅ±í´ïʽ%>ÓÐËÄÖÖÐÎʽ£¬·Ö±ðΪ<%=”hello world”%>,<%$expression%>,<%#expression%>£¬<%:abc%> ÎÒÃÇ·Ö±ðÀ´¿´Ò»ÏÂ
1£® <%=±í´ïʽ%> ÕâÖÐд·¨Ö§³Öasp£¬jspµÈµÈ£¬Ëû¾ÍÊÇÖ±½ÓÊä³ö±í´ïʽµÄÖµ£¬ËüµÈͬÓÚ
Response.Write(±í´ïʽ);
2£® <%$declarationExp:expression%> ÕâÊÇÒ»ÖÖÉùÃ÷ʽ±í´ïʽ£¬ËûÔÚAsp.Net 2.0ʱ±»ÒýÈ룬ÎÒÃÇ¿ÉÒÔÀûÓÃÕâ¸ö±í´ïʽ£¬Êä³öAppSettingsÖеÄÅäÖ㬸øSqlDataSource¿Ø¼þÉ趨Á¬½Ó×Ö·û´®µÈµÈ£¬ÔÚ.Net 4.0ʱÎÒÃÇ¿ÉÒÔÔÚÕâ¸ö±í´ïʽÖÐÊä³öUrl RoutingÖеIJÎÊýÖµ£¬»òÕ߸ù¾ÝÉèÖõõ½UrlRoutingºóµÄURL
ÀýÈ磺
1£©ÔÚLiteralÖÐÏÔʾURL Routing µ±Ç°µÄactionÖµ
<asp:Literal ID="l" EnableViewState="false" Text="<%$RouteValue:action %>" runat="server"></asp:Literal>
2£©´«Èë²ÎÊýÏÔʾRoutingºóµÄUrl
<asp:Label ID="lb" EnableViewState="false" Text="<%$RouteUrl:controller=Category ,action=edit,id=1%>" runat="server"></asp:Label>
ÔÚ.Net 4.0Ö§³ÖµÄϵͳĬÈÏÖ§³ÖµÄ±í´ïʽÓУºResources, ConnectionStrings,AppSettings,RouteUrl,RouteValueÕâЩÔÚ¸ùÅäÖÃÎļþweb.configµÄsystem.web/compilation/expressionBuildersÅäÖýÚÖÐÓÐÅäÖÃ
¸ü¶à½éÉÜ¿ÉÒԲο¼£ºhttp://msdn.microsoft.com/en-us/library/d5bd1tad(v=VS.100).aspx
http://msdn.microsoft.com/en-us/library/system.web.compilation.routeurlexpressionbuilder.aspx
3£® <%#expression%>±íʾÊý¾Ý°ó¶¨£¬±ØÐëÔÚµ÷ÓÃDataBind·½·¨²ÅÄÜÊä³ö°ó¶¨µÄÖµ£¬Í¨³£ÓÃÔÚDataGrid£¬Repeater£¬ListViewµÈÄ£°å¿Ø¼þÖС£
4£® <%:expression%>ËüÊÇÒ»¸öÐÂÔöµÄ±í´ïʽ·½Ê½£¬±íʾ½«expression HtmlEncodeºóÊä³ö£¬Èç¹ûÕâ¸ö±í´ïʽµÄÀàÐÍʱIhtmlString£¬Ëü½«Í¨¹ýIhtmlString½Ó¿ÚµÄToHtmlString()·½·¨À´×öUrlEnco
Ïà¹ØÎĵµ£º
ASP.NET»ñÈ¡ÌìÆøÔ¤±¨´óÖ·ÖÎöÓÐ 1µ½Ä³¸öÍøÕ¾ÉÏ·ÖÎöÍøÕ¾µÄ´úÂë»ñÈ¡£»2×Ô¼ºÐ´Çý¶¯·þÎñºÍweb·þÎñ µÚ¶þÖÖˮ̫Éî²»ÔøÉæ¼°¡£
ASP.NETºǫ́³ÌÐò»ñÈ¡ÖÐÑëÆøÏǫ́ÌìÆøÔ¤±¨
1.ÌìÆø·â×°³ÉÒ»¸öʵÌå
2.¿ÉÒÔ»ñÈ¡µ±ÌìÌìÆø£¬Ò²¿ÉÒÔ»ñȡδÀ´ÎåÌìµÄÌìÆø¼¯ºÏ
using System;
using System.Collections.Generic;
using System.Text;
......
¾³£ÐèÒªÔÚÊý¾Ý¿âÓëExeclÖ®¼ä»¥µ¼Êý¾Ý¡£netʱ´ú£¬ADO.NET¿ÉÒÔʹÓÃʹÓÃMicrosoft.Jet.OleDb·ÃÎÊ·ÃÎÊExcel£¬ÍøÉÏÒѾÓкܶàÀàËƵÄ×ÊÔ´£¬×îµäÐÍÒ²ÊÇ×î¼òµ¥µÄ¿ÉÄÜÈçÏ£º£¨asp.net»·¾³£©
// Á¬½Ó×Ö·û´®
......
Ò»¡¢Ä¿Ç°ÔÚASP.NETÖÐÒ³Ãæ´«Öµ¹²ÓÐÕâô¼¸ÖÖ·½Ê½£º
1¡¢±íµ¥Ìá½»£¬
<form action= "target.aspx" method = "post" name = "form1">
<input name = "param1" value = "1111"/>
<input name = "param2" value = "2222"/>
</form>
....
for ......
1. ´ò¿ªÐµĴ°¿Ú²¢´«ËͲÎÊý£º
¡¡¡¡´«ËͲÎÊý£º
response.write("£¼script£¾window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)£¼/script£¾")
¡¡¡¡½ÓÊÕ²ÎÊý£º
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
¡¡¡¡2.Ϊ°´Å¥Ìí¼Ó¶Ô»°¿ò
Button1 ......
Ò»¡¢Ð§¹û¼ò½é
¡¡¡¡µ±µã»÷Ò»¼¶À¸Ä¿Ê±£¨ÈçÊ×Ò³£©£¬±»µã»÷µÄÒ»¼¶À¸Ä¿µÄµ¥Ôª¸ñ±³¾°É«·¢Éú±äÉ«£¬Èç¹û¸ÃÒ»¼¶À¸Ä¿ÏÂÓжþ¼¶À¸Ä¿£¬Ôò»áÔÚÏÂÒ»ÐÐÏÔʾ³öÀ´£¬·ñÔò¶þ¼¶À¸Ä¿ÕâÒ»Ðв»»áÏÔʾÈκζ«Î÷£¬µ«»áÕ¼Ò»¶¨µÄ¸ß¶È¡£µ±µã»÷¶þ¼¶À¸Ä¿Ê±£¬ÆäËùÊôµÄÒ»¼¶À¸Ä¿µ¥Ôª¸ñ±³¾°É«·¢Éú±ä»¯£¬Í¬Ê±±»µã»÷µÄ¶þ¼¶À¸Ä¿Ãû³Æ»á¼Ó´Ö£¬²¢ÔÚÇ°·½¼ÓÒ»¸ö“¡ ......