{"id":2482,"date":"2014-07-09T15:17:57","date_gmt":"2014-07-09T07:17:57","guid":{"rendered":"http:\/\/kuki.idv.tw\/?p=2482"},"modified":"2014-07-09T15:17:57","modified_gmt":"2014-07-09T07:17:57","slug":"%e8%bd%89asp-net-mvc3-razor-%e5%88%9d%e5%bf%83%e8%80%85%e5%ae%b9%e6%98%93%e9%81%87%e5%88%b0%e7%9a%84%e5%95%8f%e9%a1%8c","status":"publish","type":"post","link":"https:\/\/www.kuki.idv.tw\/?p=2482","title":{"rendered":"[\u8f49]ASP.NET MVC3 Razor \u521d\u5fc3\u8005\u5bb9\u6613\u9047\u5230\u7684\u554f\u984c"},"content":{"rendered":"<p>http:\/\/demo.tc\/Post\/679<\/p>\n<p style=\"color: #444444;\">\u5728 ASP.NET MVC 3 \u4e2d\u589e\u52a0\u4e86\u4e00\u7a2e\u65b0\u7684 \u8996\u5716\u5f15\u64ce\uff08 View Engine \uff09\u512a\u9ede\u76f8\u7576\u7684\u591a\u56e0\u6b64 demo \u76f8\u4fe1\u5982\u679c\u8981\u5beb ASP.NET MVC 3 \u7684\u670b\u53cb\u7d55\u5927\u591a\u6578\u90fd\u6703\u9078\u64c7\u4f7f\u7528 Razor \u4f46\u56e0\u70ba\u5beb\u6cd5\u6539\u8b8a\uff0c\u525b\u958b\u59cb\u53ef\u80fd\u662f\u6703\u5341\u5206\u4e0d\u7fd2\u6163\uff0c\u751a\u81f3\u4e00\u4e9b\u5f88\u7c21\u55ae\u7684\u6771\u897f\u9084\u8981 Try \u5f88\u591a\u6b21\u624d\u6703\u6210\u529f\uff0c\u56e0\u6b64 demo \u7279\u5225\u6574\u7406\u4e86\u4e00\u4e0b\uff0c\u6211\u5beb demo\u5c0f\u92ea\u6642\u6709\u505c\u9813\u7684\u5730\u65b9\uff0c\u671f\u671b\u6709\u9700\u8981\u7684\u7db2\u53cb\u53ef\u4ee5\u66f4\u5feb\u7684\u63a5\u89f8 Razor \u9019\u76f8\u7576\u512a\u826f\u7684 \u8996\u5716\u5f15\u64ce\uff08 View Engine \uff09<\/p>\n<div id=\"ysmAD1250_1\" style=\"color: #444444;\">\n<div id=\"ysm_hybrid_s03\" class=\"cont\" style=\"font-weight: inherit; color: #000000;\"><span class=\"ysmlabel\" style=\"font-weight: inherit; font-style: inherit; color: #999999;\"><a style=\"font-weight: inherit; font-style: inherit; color: #999999;\" href=\"http:\/\/tw.rd.yahoo.com\/referurl\/hp\/beta\/f\/ysm\/partners\/evt=51414\/*http:\/\/tw.emarketing.yahoo.com\/ysm\/contactus\/index.html?o=TW0137&amp;cmp=TW0137\" target=\"_blank\">Ads by Yahoo!<\/a><\/span><\/p>\n<div id=\"ysm_listing_s03\" style=\"font-weight: inherit;\">\n<ul style=\"font-weight: inherit;\">\n<li style=\"font-weight: inherit;\">\n<div style=\"font-weight: inherit;\">\n<h3 style=\"color: #0000bb;\">\u96f2\u7aef\u9032\u92b7\u5b58\u6703\u8a08\u5eab\u5b58\u7ba1\u7406\u7cfb\u7d71<\/h3>\n<p><cite style=\"color: #007500;\">Web-ACC.com<\/cite><\/p>\n<p class=\"descr\" style=\"font-weight: inherit;\">\u8de8\u5e73\u53f0\u4e14\u53ef\u4ee5\u4f7f\u7528\u667a\u6167\u578b\u624b\u6a5f\u767b\u9304\u7684\u9032\u92b7\u5b58\u7ba1\u7406\u7cfb\u7d71, \u7dda\u4e0a\u514d\u8cbb\u8a66\u7528\u4e0d\u9700\u5b89\u88ddAPP<\/p>\n<\/div>\n<\/li>\n<li style=\"font-weight: inherit;\">\n<div style=\"font-weight: inherit;\">\n<h3 style=\"color: #0000bb;\">\u53f0\u5851\u5546\u696d\u6d41\u7a0b\u7ba1\u7406BPM\u65b9\u6848<\/h3>\n<p><cite style=\"color: #007500;\">www.efpg.com.tw<\/cite><\/p>\n<p class=\"descr\" style=\"font-weight: inherit;\">FPG-Flow\u53ef\u6574\u5408ERP\u5167\u5efa\u57fa\u672c\u8868\u55ae\uff0c\u5f48\u6027\u8a2d\u8a08\uff0c\u5f37\u5316bpm\u74b0\u5883\u652f\u63f4\u57f7\u884c\u529b\u3002<\/p>\n<\/div>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<ul class=\"styleul\" style=\"color: #444444;\">\n<li style=\"font-weight: inherit; font-style: inherit;\">\u6a94\u6848\u7248\u672c\uff1a3<\/li>\n<li style=\"font-weight: inherit; font-style: inherit;\">\u6700\u5f8c\u66f4\u65b0\uff1a2012\/8\/14 \u4e0a\u5348 10:41:29<\/li>\n<\/ul>\n<div class=\"update\" style=\"color: #444444;\">\n<ul style=\"font-weight: inherit; font-style: inherit;\">\n<li style=\"font-weight: inherit; font-style: inherit;\">2011-06-13\uff1a\u589e\u52a0\u96fb\u5b50\u90f5\u4ef6\u8207@() \u7684\u7528\u6cd5\u8aaa\u660e<\/li>\n<\/ul>\n<\/div>\n<h3 style=\"color: #444444;\"><img decoding=\"async\" loading=\"lazy\" style=\"font-weight: inherit; font-style: inherit;\" title=\"\u25cf\" src=\"http:\/\/demo.tc\/images\/msn\/title02.gif\" alt=\"\u25cf\" width=\"16\" height=\"16\" \/>\u57fa\u672c\u5beb\u6cd5\u4ecb\u7d39<\/h3>\n<p style=\"color: #444444;\">\u70ba\u4e86\u8b93\u6587\u7ae0\u66f4\u6e05\u695a\u9019\u88e1\u5148\u5047\u8a2d\u4ee5\u4e0b\u8f38\u51fa\u503c<\/p>\n<div class=\"snippet-container\" style=\"color: #444444;\">\n<div class=\"sh_ide-msvcpp snippet-wrap\" style=\"font-weight: inherit; font-style: inherit;\">\n<ol class=\"snippet-num\" style=\"font-weight: inherit; font-style: inherit;\">\n<li style=\"font-weight: inherit; font-style: inherit;\">Model<span class=\"sh_symbol\" style=\"font-weight: inherit; font-style: inherit;\">.<\/span>Content<span class=\"sh_symbol\" style=\"font-weight: inherit; font-style: inherit;\">=<\/span><span class=\"sh_string\">&#8220;&lt;a href=&#8217;http:\/\/demo.tc&#8217; &gt;demo\u5c0f\u92ea&lt;\/a&gt;&#8221;<\/span><\/li>\n<li style=\"font-weight: inherit; font-style: inherit;\"><\/li>\n<li style=\"font-weight: inherit; font-style: inherit;\">item<span class=\"sh_symbol\" style=\"font-weight: inherit; font-style: inherit;\">.<\/span>Key<span class=\"sh_symbol\" style=\"font-weight: inherit; font-style: inherit;\">=<\/span><span class=\"sh_string\">&#8220;&lt;span&gt;IsKey&lt;\/span&gt;&#8221;<\/span><\/li>\n<li style=\"font-weight: inherit; font-style: inherit;\"><\/li>\n<li style=\"font-weight: inherit; font-style: inherit;\">item<span class=\"sh_symbol\" style=\"font-weight: inherit; font-style: inherit;\">.<\/span>Value<span class=\"sh_symbol\" style=\"font-weight: inherit; font-style: inherit;\">=<\/span><span class=\"sh_string\">&#8220;&lt;span&gt;IsValue&lt;\/span&gt;&#8221;<\/span><\/li>\n<\/ol>\n<\/div>\n<\/div>\n<p style=\"color: #444444;\">\n<table class=\"border_table\" style=\"color: #444444;\">\n<tbody style=\"font-weight: inherit; font-style: inherit;\">\n<tr style=\"font-weight: inherit; font-style: inherit;\">\n<th style=\"font-style: inherit;\">Razor<\/th>\n<th style=\"font-style: inherit;\">Aspx<\/th>\n<\/tr>\n<tr style=\"font-weight: inherit; font-style: inherit;\">\n<td style=\"font-style: inherit;\" colspan=\"2\">\u7a0b\u5f0f\u78bc\u5340\u584a\uff1a\u7121\u8f38\u51fa<\/td>\n<\/tr>\n<tr style=\"font-weight: inherit; font-style: inherit;\">\n<td style=\"font-style: inherit;\">\n<pre style=\"font-weight: inherit; font-style: inherit;\"><span style=\"font-weight: inherit; font-style: inherit;\">@{<\/span>\r\n\u00a0\u00a0\u00a0\u00a0<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">int<\/span>\u00a0a\u00a0=\u00a0123;\r\n\u00a0\u00a0\u00a0\u00a0<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">string<\/span>\u00a0b\u00a0=\u00a0<span style=\"font-weight: inherit; font-style: inherit; color: #a31515;\">\"demoshop\"<\/span>;\r\n\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">}<\/span><\/pre>\n<\/td>\n<td style=\"font-style: inherit;\">\n<pre style=\"font-weight: inherit; font-style: inherit;\"><span style=\"font-weight: inherit; font-style: inherit;\">&lt;%<\/span>\r\n\u00a0\u00a0\u00a0\u00a0<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">int<\/span>\u00a0a\u00a0=\u00a0123;\r\n\u00a0\u00a0\u00a0\u00a0<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">string<\/span>\u00a0b\u00a0=\u00a0<span style=\"font-weight: inherit; font-style: inherit; color: #a31515;\">\"demoshop\"<\/span>;\r\n<span style=\"font-weight: inherit; font-style: inherit;\">%&gt;<\/span><\/pre>\n<\/td>\n<\/tr>\n<tr style=\"font-weight: inherit; font-style: inherit;\">\n<td style=\"font-style: inherit;\" colspan=\"2\">HTML Encoded\uff1a&lt;a href=&#8217;http:\/\/demo.tc&#8217; &gt;demo\u5c0f\u92ea&lt;\/a&gt;<\/td>\n<\/tr>\n<tr style=\"font-weight: inherit; font-style: inherit;\">\n<td style=\"font-style: inherit;\">\n<pre style=\"font-weight: inherit; font-style: inherit;\"><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">&lt;<\/span><span style=\"font-weight: inherit; font-style: inherit; color: maroon;\">div<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">&gt;<\/span>\r\n\u00a0\u00a0\u00a0\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">@<\/span>Model.Content\r\n<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">&lt;\/<\/span><span style=\"font-weight: inherit; font-style: inherit; color: maroon;\">div<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">&gt;<\/span><\/pre>\n<\/td>\n<td style=\"font-style: inherit;\">\n<pre style=\"font-weight: inherit; font-style: inherit;\"><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">&lt;<\/span><span style=\"font-weight: inherit; font-style: inherit; color: maroon;\">div<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">&gt;<\/span>\r\n\u00a0\u00a0\u00a0\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">&lt;%<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">:<\/span>Model.Content\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">%&gt;<\/span>\r\n<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">&lt;\/<\/span><span style=\"font-weight: inherit; font-style: inherit; color: maroon;\">div<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">&gt;<\/span><\/pre>\n<\/td>\n<\/tr>\n<tr style=\"font-weight: inherit; font-style: inherit;\">\n<td style=\"font-style: inherit;\" colspan=\"2\">HTML Unencoded\uff1a<a style=\"font-weight: inherit; font-style: inherit; color: #184e70;\" href=\"http:\/\/demo.tc\/\">demo\u5c0f\u92ea<\/a><\/td>\n<\/tr>\n<tr style=\"font-weight: inherit; font-style: inherit;\">\n<td style=\"font-style: inherit;\">\n<pre style=\"font-weight: inherit; font-style: inherit;\"><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">&lt;<\/span><span style=\"font-weight: inherit; font-style: inherit; color: maroon;\">div<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">&gt;<\/span>\r\n\u00a0\u00a0\u00a0\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">@<\/span>Html.Raw(Model.Content)\r\n<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">&lt;\/<\/span><span style=\"font-weight: inherit; font-style: inherit; color: maroon;\">div<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">&gt;<\/span><\/pre>\n<\/td>\n<td style=\"font-style: inherit;\">\n<pre style=\"font-weight: inherit; font-style: inherit;\"><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">&lt;<\/span><span style=\"font-weight: inherit; font-style: inherit; color: maroon;\">div<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">&gt;<\/span>\r\n\u00a0\u00a0\u00a0\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">&lt;%<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">=<\/span>Model.Content\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">%&gt;<\/span>\r\n<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">&lt;\/<\/span><span style=\"font-weight: inherit; font-style: inherit; color: maroon;\">div<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">&gt;<\/span><\/pre>\n<\/td>\n<\/tr>\n<tr style=\"font-weight: inherit; font-style: inherit;\">\n<td style=\"font-style: inherit;\" colspan=\"2\">\u6df7\u5408\u7a0b\u5f0f\u78bc\uff1a&lt;span&gt;IsKey&lt;\/span&gt;<\/td>\n<\/tr>\n<tr style=\"font-weight: inherit; font-style: inherit;\">\n<td style=\"font-style: inherit;\">\n<pre style=\"font-weight: inherit; font-style: inherit;\"><span style=\"font-weight: inherit; font-style: inherit;\">@<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">foreach<\/span>\u00a0(<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">var<\/span>\u00a0item\u00a0<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">in<\/span>\u00a0collection)\r\n{\r\n\u00a0\u00a0\u00a0\u00a0<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">&lt;<\/span><span style=\"font-weight: inherit; font-style: inherit; color: maroon;\">span<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">&gt;<\/span><span style=\"font-weight: inherit; font-style: inherit;\">@<\/span>item.Key<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">&lt;\/<\/span><span style=\"font-weight: inherit; font-style: inherit; color: maroon;\">span<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">&gt;<\/span>\r\n}<\/pre>\n<\/td>\n<td style=\"font-style: inherit;\">\n<pre style=\"font-weight: inherit; font-style: inherit;\"><span style=\"font-weight: inherit; font-style: inherit;\">&lt;%<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">foreach<\/span>\u00a0(<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">var<\/span>\u00a0item\u00a0<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">in<\/span>\u00a0collection)\r\n\u00a0\u00a0\u00a0\u00a0{<span style=\"font-weight: inherit; font-style: inherit;\">%&gt;<\/span>\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">&lt;<\/span><span style=\"font-weight: inherit; font-style: inherit; color: maroon;\">span<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">&gt;<\/span><span style=\"font-weight: inherit; font-style: inherit;\">&lt;%<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">:<\/span>item.Key\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">%&gt;<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">&lt;\/<\/span><span style=\"font-weight: inherit; font-style: inherit; color: maroon;\">span<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">&gt;<\/span>\r\n<span style=\"font-weight: inherit; font-style: inherit;\">&lt;%<\/span>}\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">%&gt;<\/span><\/pre>\n<\/td>\n<\/tr>\n<tr style=\"font-weight: inherit; font-style: inherit;\">\n<td style=\"font-style: inherit;\" colspan=\"2\">\u6df7\u5408\u7a0b\u5f0f\u78bc\uff1a\u6211\u662f\u7d14\u6587\u5b57 &lt;span&gt;IsValue&lt;\/span&gt;<\/td>\n<\/tr>\n<tr style=\"font-weight: inherit; font-style: inherit;\">\n<td style=\"font-style: inherit;\">\n<pre style=\"font-weight: inherit; font-style: inherit;\"><span style=\"font-weight: inherit; font-style: inherit;\">@<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">foreach<\/span>\u00a0(<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">var<\/span>\u00a0item\u00a0<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">in<\/span>\u00a0collection)\r\n{\r\n\u00a0\u00a0\u00a0\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">&lt;text&gt;<\/span>\u6211\u662f\u7d14\u6587\u5b57<span style=\"font-weight: inherit; font-style: inherit;\">&lt;\/text&gt;<\/span>\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">@<\/span>item.Value\r\n}<\/pre>\n<\/td>\n<td style=\"font-style: inherit;\">\n<pre style=\"font-weight: inherit; font-style: inherit;\"><span style=\"font-weight: inherit; font-style: inherit;\">&lt;%<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">foreach<\/span>\u00a0(<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">var<\/span>\u00a0item\u00a0<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">in<\/span>\u00a0collection)\r\n\u00a0\u00a0\u00a0\u00a0{<span style=\"font-weight: inherit; font-style: inherit;\">%&gt;<\/span>\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u6211\u662f\u7d14\u6587\u5b57\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">&lt;%<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">:<\/span>item.Key\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">%&gt;<\/span>\r\n<span style=\"font-weight: inherit; font-style: inherit;\">&lt;%<\/span>}\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">%&gt;<\/span><\/pre>\n<\/td>\n<\/tr>\n<tr style=\"font-weight: inherit; font-style: inherit;\">\n<td style=\"font-style: inherit;\" colspan=\"2\">\u6df7\u5408\u7a0b\u5f0f\u78bc\uff1a\u6211\u662f\u7d14\u6587\u5b57 &lt;span&gt;IsValue&lt;\/span&gt;<\/td>\n<\/tr>\n<tr style=\"font-weight: inherit; font-style: inherit;\">\n<td style=\"font-style: inherit;\">\n<pre style=\"font-weight: inherit; font-style: inherit;\"><span style=\"font-weight: inherit; font-style: inherit;\">@<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">foreach<\/span>\u00a0(<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">var<\/span>\u00a0item\u00a0<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">in<\/span>\u00a0collection)\r\n{\r\n\u00a0\u00a0\u00a0\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">@:<\/span>\u6211\u662f\u7d14\u6587\u5b57\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">@<\/span>item.Value\r\n}<\/pre>\n<\/td>\n<td style=\"font-style: inherit;\">\n<pre style=\"font-weight: inherit; font-style: inherit;\"><span style=\"font-weight: inherit; font-style: inherit;\">&lt;%<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">foreach<\/span>\u00a0(<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">var<\/span>\u00a0item\u00a0<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">in<\/span>\u00a0collection)\r\n\u00a0\u00a0\u00a0\u00a0{<span style=\"font-weight: inherit; font-style: inherit;\">%&gt;<\/span>\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u6211\u662f\u7d14\u6587\u5b57\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">&lt;%<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">:<\/span>item.Key\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">%&gt;<\/span>\r\n<span style=\"font-weight: inherit; font-style: inherit;\">&lt;%<\/span>}\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">%&gt;<\/span><\/pre>\n<\/td>\n<\/tr>\n<tr style=\"font-weight: inherit; font-style: inherit;\">\n<td style=\"font-style: inherit;\" colspan=\"2\">\u6df7\u5408\u7a0b\u5f0f\u78bc\uff1a\u76ee\u524d\u662f\u7b2c 0. \u76ee\u524d\u662f\u7b2c 1. \u76ee\u524d\u662f\u7b2c 2.<\/td>\n<\/tr>\n<tr style=\"font-weight: inherit; font-style: inherit;\">\n<td style=\"font-style: inherit;\">\n<pre style=\"font-weight: inherit; font-style: inherit;\"><span style=\"font-weight: inherit; font-style: inherit;\">@<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">for<\/span>\u00a0(<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">int<\/span>\u00a0i\u00a0=\u00a00;\u00a0i\u00a0&lt;\u00a03;\u00a0i++)\r\n{\r\n\u00a0\u00a0\u00a0\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">@:<\/span>\u76ee\u524d\u662f\u7b2c\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">@<\/span>i.\u00a0\r\n}<\/pre>\n<\/td>\n<td style=\"font-style: inherit;\">\n<pre style=\"font-weight: inherit; font-style: inherit;\"><span style=\"font-weight: inherit; font-style: inherit;\">&lt;%<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">for<\/span>\u00a0(<span style=\"font-weight: inherit; font-style: inherit; color: blue;\">int<\/span>\u00a0i\u00a0=\u00a00;\u00a0i\u00a0&lt;\u00a03;\u00a0i++)\r\n\u00a0\u00a0{<span style=\"font-weight: inherit; font-style: inherit;\">%&gt;<\/span>\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u76ee\u524d\u662f\u7b2c<span style=\"font-weight: inherit; font-style: inherit;\">&lt;%<\/span><span style=\"font-weight: inherit; font-style: inherit; color: blue;\">=<\/span>i\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">%&gt;<\/span>.\r\n<span style=\"font-weight: inherit; font-style: inherit;\">&lt;%<\/span>}\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">%&gt;<\/span><\/pre>\n<\/td>\n<\/tr>\n<tr style=\"font-weight: inherit; font-style: inherit;\">\n<td style=\"font-style: inherit;\" colspan=\"2\">\u4e09\u5143\u904b\u7b97\u5b50\uff1a&lt;a href=&#8217;http:\/\/demo.tc&#8217; &gt;demo\u5c0f\u92ea&lt;\/a&gt;<\/td>\n<\/tr>\n<tr style=\"font-weight: inherit; font-style: inherit;\">\n<td style=\"font-style: inherit;\">\n<pre style=\"font-weight: inherit; font-style: inherit;\"><span style=\"font-weight: inherit; font-style: inherit;\">@(<\/span>Model.Content\u00a0==\u00a0<span style=\"font-weight: inherit; font-style: inherit; color: #a31515;\">\"\"<\/span>\u00a0?\u00a0<span style=\"font-weight: inherit; font-style: inherit; color: #a31515;\">\"\u6c92\u8ca8\"<\/span>\u00a0:\u00a0Model.Content<span style=\"font-weight: inherit; font-style: inherit;\">)<\/span>\r\n\r\n<\/pre>\n<\/td>\n<td style=\"font-style: inherit;\">\n<pre style=\"font-weight: inherit; font-style: inherit;\"><span style=\"font-weight: inherit; font-style: inherit;\">&lt;%<\/span>:Model.Content==<span style=\"font-weight: inherit; font-style: inherit; color: #a31515;\">\"\"<\/span>?<span style=\"font-weight: inherit; font-style: inherit; color: #a31515;\">\"\u6c92\u8ca8\"<\/span>:\u00a0Model.Content<span style=\"font-weight: inherit; font-style: inherit;\">%&gt;<\/span>\r\n<\/pre>\n<\/td>\n<\/tr>\n<tr style=\"font-weight: inherit; font-style: inherit;\">\n<td style=\"font-style: inherit;\" colspan=\"2\">\u8a3b\u89e3\uff1a\u7121\u8f38\u51fa<\/td>\n<\/tr>\n<tr style=\"font-weight: inherit; font-style: inherit;\">\n<td style=\"font-style: inherit;\">\n<pre style=\"font-weight: inherit; font-style: inherit;\"><span style=\"font-weight: inherit; font-style: inherit;\">@*<\/span><span style=\"font-weight: inherit; font-style: inherit; color: #006400;\">\u4f60\u770b\u4e0d\u5230\u6211<\/span><span style=\"font-weight: inherit; font-style: inherit;\">*@<\/span>\r\n<\/pre>\n<\/td>\n<td style=\"font-style: inherit;\">\n<pre style=\"font-weight: inherit; font-style: inherit;\"><span style=\"font-weight: inherit; font-style: inherit;\">&lt;%<\/span><span style=\"font-weight: inherit; font-style: inherit; color: #006400;\">--\u4f60\u770b\u4e0d\u5230\u6211--<\/span><span style=\"font-weight: inherit; font-style: inherit;\">%&gt;<\/span>\r\n<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"color: #444444;\">\u4ee5\u4e0a\u90e8\u5206\u8868\u683c\u53c3\u8003<a style=\"font-weight: inherit; font-style: inherit; color: #184e70;\" href=\"http:\/\/haacked.com\/archive\/2011\/01\/06\/razor-syntax-quick-reference.aspx\" target=\"_blank\">C# Razor Syntax Quick Reference<\/a>\u3002<\/p>\n<hr style=\"color: #444444;\" \/>\n<h3 style=\"color: #444444;\"><img decoding=\"async\" loading=\"lazy\" style=\"font-weight: inherit; font-style: inherit;\" title=\"\u25cf\" src=\"http:\/\/demo.tc\/images\/msn\/title02.gif\" alt=\"\u25cf\" width=\"16\" height=\"16\" \/>\u795e\u5947\u7684 [at] \u7b26\u865f<\/h3>\n<p style=\"color: #444444;\">@\u5ff5\u6cd5\u662f [at] \uff0c\u53f0\u7063\u4fd7\u7a31\u5c0f\u8001\u9f20\uff0c\u5728 Razor \u4e2d\u5b83\u6709\u8209\u8db3\u8f15\u91cd\u7684\u7528\u8655\uff0c\u56e0\u70ba\u540c\u6642\u5217\u5728\u4e0a\u8868 demo \u89ba\u5f97\u6709\u9ede\u4e82\u56e0\u6b64\u5728\u7d66\u5b83\u4e00\u500b\u5340\u584a\u4f86\u653e\u5b83\uff0cRazor \u5f88\u6709\u8da3!\u57fa\u672c\u4e0a\u5b83\u6703\u5224\u65b7\u7a7a\u767d\u5b57\u5143\u8207\u65b7\u884c\u7b26\u865f<\/p>\n<p style=\"color: #444444;\"><img decoding=\"async\" loading=\"lazy\" style=\"font-weight: inherit; font-style: inherit;\" title=\"\u25cf\" src=\"http:\/\/demo.tc\/images\/msn\/title03.gif\" alt=\"\u25cf\" width=\"16\" height=\"16\" \/>\u6bd4\u5982\u8aaa\u6211\u9700\u8981\u8f38\u51fa item.Key\u548citem.Value \u7684\u503c\u53ef\u4ee5\u6709\u4ee5\u4e0b\u7684\u5beb\u6cd5<\/p>\n<pre class=\"html;highlight:[0];\" style=\"color: #444444;\">@item.Key@item.Value\r\n\r\n@(item.Key + item.Value)<\/pre>\n<hr style=\"color: #444444;\" \/>\n<p style=\"color: #444444;\"><img decoding=\"async\" loading=\"lazy\" style=\"font-weight: inherit; font-style: inherit;\" title=\"\u25cf\" src=\"http:\/\/demo.tc\/images\/msn\/title03.gif\" alt=\"\u25cf\" width=\"16\" height=\"16\" \/>\u5982\u679c\u4f60\u9700\u8981 Unencoded<\/p>\n<pre class=\"html;highlight:[0];\" style=\"color: #444444;\">@:item.Key @item.Value<\/pre>\n<hr style=\"color: #444444;\" \/>\n<p style=\"color: #444444;\"><img decoding=\"async\" loading=\"lazy\" style=\"font-weight: inherit; font-style: inherit;\" title=\"\u25cf\" src=\"http:\/\/demo.tc\/images\/msn\/title03.gif\" alt=\"\u25cf\" width=\"16\" height=\"16\" \/>\u5982\u679c\u8981\u8f38\u51fa I @ Taiwan<\/p>\n<pre class=\"html;highlight:[0];\" style=\"color: #444444;\">I @@ Taiwan<\/pre>\n<hr style=\"color: #444444;\" \/>\n<p style=\"color: #444444;\"><img decoding=\"async\" loading=\"lazy\" style=\"font-weight: inherit; font-style: inherit;\" title=\"\u25cf\" src=\"http:\/\/demo.tc\/images\/msn\/title03.gif\" alt=\"\u25cf\" width=\"16\" height=\"16\" \/>email \u7684\u8f38\u51fa\u6839\u672c\u4e0d\u9700\u8981\u6709\u4efb\u4f55\u8abf\u6574<\/p>\n<pre class=\"html;highlight:[0];\" style=\"color: #444444;\">test@test.com<\/pre>\n<hr style=\"color: #444444;\" \/>\n<p style=\"color: #444444;\"><img decoding=\"async\" loading=\"lazy\" style=\"font-weight: inherit; font-style: inherit;\" title=\"demo\u5ee2\u8a00\" src=\"http:\/\/demo.tc\/images\/msn\/demosay.gif\" alt=\"demo\u5ee2\u8a00\" width=\"88\" height=\"16\" \/>\u524d\u6587\u6709\u63d0\u5230 Razor \u6703\u5224\u65b7\u7a7a\u767d\u5b57\u5143\u548c\u65b7\u884c\u7b26\u865f\uff0c\u4e5f\u56e0\u70ba Email \u7684\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">@<\/span>\u00a0\u524d\u5f8c\u90fd\u6709\u5b57\u6240\u4ee5\u6703\u5f88\u8070\u660e\u7684\u8a8d\u5b9a\u5b83\u70ba\u5b57\u4e32\uff0c\u4e26\u4e0d\u6703\u7576\u8b8a\u6578\u770b\uff0c\u518d\u4f86\u770b\u4e0b\u9762\u4e00\u500b\u7bc4\u4f8b\u6703\u66f4\u6e05\u695a<\/p>\n<p style=\"color: #444444;\">\u4f9d\u64da\u4e0a\u9762\u7684\u7bc4\u4f8b\u4eca\u5929\u6211\u5011\u8981\u8f38\u51fa\u00a0<span style=\"font-weight: inherit; font-style: inherit;\"><span style=\"font-weight: inherit; font-style: inherit; color: #ff8c00;\">demo\u6b61\u8fce\u767b\u5165<\/span><\/span>\u7684\u5b57\u6a23\uff0c\u7db2\u53cb\u5011\u53ef\u80fd\u6703\u9019\u6a23\u5beb<\/p>\n<pre class=\"html;highlight:[0];\" style=\"color: #444444;\">@User.Identity.Name \u6b61\u8fce\u767b\u5165 \/\/\u8b8a\u6578\u548c\u6587\u5b57\u4e2d\u5229\u7528\u4e00\u500b\u534a\u578b\u7a7a\u767d\u4f86\u65b7\u958b<\/pre>\n<p style=\"color: #444444;\">\u4f46\u9019\u6709\u53ef\u80fd\u662f\u6211\u5011\u4e0d\u60f3\u8981\u7684\u6548\u679c\uff0c\u90a3\u5c31\u53ef\u4ee5\u5229\u7528\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">@()<\/span>\u00a0\u5305\u4f4f\u8b8a\u6578\u5c07\u5b83\u6539\u5beb\u70ba<\/p>\n<pre class=\"html;highlight:[0];\" style=\"color: #444444;\">@(User.Identity.Name)\u6b61\u8fce\u767b\u5165<\/pre>\n<p style=\"color: #444444;\">\u5c31\u6703\u662f\u9ecf\u5728\u4e00\u8d77\u7684\u6587\u5b57\u4e86<\/p>\n<hr style=\"color: #444444;\" \/>\n<h3 style=\"color: #444444;\"><img decoding=\"async\" loading=\"lazy\" style=\"font-weight: inherit; font-style: inherit;\" title=\"\u25cf\" src=\"http:\/\/demo.tc\/images\/msn\/title02.gif\" alt=\"\u25cf\" width=\"16\" height=\"16\" \/>\u540c\u5834\u52a0\u6620HTML5 \u652f\u63f4<\/h3>\n<p style=\"color: #444444;\">\u5728 HTML5 \u4e2d\u6709\u4e00\u500b\u5f88\u4e0d\u932f\u7684\u8cc7\u6599\u8a18\u9304\u6a19\u7c64 data-xxx \uff0c\u56e0\u70ba\u4f7f\u7528\u4ed6\u4e0d\u9700\u8981\u81ea\u884c\u5b9a\u7fa9\u6a19\u7c64\u56e0\u6b64 demo \u9084\u6eff\u559c\u6b61\u7684\u800c\u4e14\u5229\u7528 jQuery \u5c31\u53ef\u4ee5\u76f8\u7576\u7c21\u55ae\u7684\u628a \u9019\u6a19\u7c64\u7684\u503c\u53d6\u51fa\uff08\u00a0<a style=\"font-weight: inherit; font-style: inherit; color: #184e70;\" href=\"http:\/\/api.jquery.com\/jQuery.data\/\" target=\"_blank\">\u5b98\u65b9 API<\/a>\u00a0\uff09\u4f46\u662f\u5982\u679c\u4f60\u60f3\u5728 ASP.NET MVC3 \u4e2d\u4f7f\u7528\u9700\u8981\u8abf\u6574\u4e00\u4e0b\u5beb\u6cd5<\/p>\n<pre class=\"html;highlight:[0];\" style=\"color: #444444;\">@Html.TextBoxFor(model =&gt; model.Key, new {data_test=\"500\" })<\/pre>\n<p style=\"color: #444444;\">\u5fc5\u9808\u8981\u4f7f\u7528\u5e95\u7dda\uff0c\u7de8\u8b6f\u7684\u6642\u5019\u6703\u81ea\u52d5\u8f49\u63db<\/p>\n<p><span class=\"ref\" style=\"color: #444444;\"><img decoding=\"async\" style=\"font-weight: inherit; font-style: inherit;\" title=\"\u53c3\u8003\u6587\u7ae0\" src=\"http:\/\/demo.tc\/Images\/linkPage.gif\" alt=\"\u53c3\u8003\u6587\u7ae0\" \/><\/span><\/p>\n<ul style=\"color: #444444;\">\n<li style=\"font-weight: inherit; font-style: inherit;\"><a style=\"font-weight: inherit; font-style: inherit; color: #184e70;\" href=\"http:\/\/haacked.com\/archive\/2011\/01\/06\/razor-syntax-quick-reference.aspx\" target=\"_blank\" rel=\"external nofollow\">C# Razor Syntax Quick Reference<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>http:\/\/demo.tc\/Post\/679 \u5728 ASP.NET MVC 3 \u4e2d\u589e\u52a0\u4e86\u4e00\u7a2e\u65b0\u7684 \u8996\u5716\u5f15\u64ce\uff08  &hellip; <a href=\"https:\/\/www.kuki.idv.tw\/?p=2482\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008[\u8f49]ASP.NET MVC3 Razor \u521d\u5fc3\u8005\u5bb9\u6613\u9047\u5230\u7684\u554f\u984c\u3009<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/2482"}],"collection":[{"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2482"}],"version-history":[{"count":1,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/2482\/revisions"}],"predecessor-version":[{"id":2483,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/2482\/revisions\/2483"}],"wp:attachment":[{"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2482"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2482"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2482"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}