我在使用的語法中有點混淆MVC。請告訴我什麼是這兩個參數之間的區別如下記載:
<%= Html.LabelFor(model=> model.studFatherName) %>
和
<%: Html.LabelFor(model=> model.studFatherName) %>
Synthical difference b/w <%= Html.LabelFor(model => model.studFatherName)%>和<%:Html.LabelFor(model => model.studFatherName)%>
0
A
回答
2
<%: %>
用於HTML編碼值,而<%= %>
輸出值不變。例如:
<%= "<br/>" %>
呈現爲<br/>
而<%: %>
呈現爲<br/>
。但有一個例外。如果參數是IHtmlString
,則<%: %>
的行爲與<%= %>
的行爲完全相同,即它不編碼該值。並且由於LabelFor
幫手返回IHtmlString <%: Html.LabelFor(x => x.studFatherName) %>
絕對等效於<%= Html.LabelFor(x => x.studFatherName) %>
。
相關問題
- 1. 如何將RealmResults <Model>轉換爲ArrayList <Model>?
- 2. <a>嵌套內部Html.LabelFor
- 3. 如何在同一頁面(List/Create)使用@model IEnumerable <>和@model <> MVC3
- 4. Symfony FORMS:{'model'=> $ this-> getRelatedModelName('model')}和{'model'=>'model'}在setWidgets中的差異
- 5. 有鑑於<code>model</code>新屬性
- 6. MVC強類型IQueryable <IGrouping <TKey,TElement >> model
- 7. Dictionary <short,Dictionary <EnFunction,bool >> model binding not working
- 8. 獲取在與筆者<code>model</code>用(<code>ForeignKey).</code>使用<code>Post.objects.all()</code>得到的Django
- 9. 浮動元素<br /><br /><br /><br /><br /\><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
- 10. Angular:ng-model directive not working with'<span>`element
- 11. 刪除列表<Model>(ASP MVC 5)
- 12. NoMethodError(undefined method'highlight'for#<Elasticsearch :: Model :: Response :: Result>
- 13. 的Grails:前</p> <pre><code><g:if test="${foo.bar}"> </code></pre> <p>和</p> <pre><code><g:if test="\${foo.bar}"> </code></pre> <p>使用 「\」 的真正爲例:\ $ {}和$ {}
- 14. Task <>和IAsyncOperation <>
- 15. <ice:outputMedia>和<ui:repeat>
- 16. 使用>>,>,> |,||,| <,<,<<,<<
- 17. 的MySQL/PHP:<code>id</code>,<code>name</code>,<code>category</code>和一個<code>ratings</code>表列:<code>id</code>,<code>item</code>,<code>rating</code>如何使用JOIN語句
- 18. 如</p> <p><code><p>This is text </p></code>或<code><div></code>或<code>This is text</code></p> <p>使用<code>XmlPullParser</code>檢索URL
- 19. C#-IComparable <T>和IEquatable <T>
- 20. 如何指定ID爲Html.LabelFor <>(MVC剃刀)
- 21. Yii中的$ model-> attributes和$ model-> setAttributes()之間的區別
- 22. 像</p> <pre><code>Component { id: movie_delegate MovieListItem { movie: movie } } </code></pre> <p>內的JavaScript
- 23. <%# %> VS <%= %>
- 24. <TextView /> OR <TextView></TextView>
- 25. <script></script> or <script />?
- 26. <asp:XXXX > vs <%# %>/<%@ %>
- 27. <textview></textview>與<textview />
- 28. <ContentControl><ContentPresenter /></ ContentControl>?
- 29. 使用</p> <pre><code>$programItem[0]->Name </code></pre> <p>在名稱
- 30. 什麼是什麼是一個使用</p> <p><code>javac -cp classes helloworld.java</code></p> <p>和</p> <p><code>javac -classpath classes helloworld.java</code></p> 在CMD <p>的區別-cp和-classpath
可能的重複[MVC2如何<%:標記不同於<%=](http://stackoverflow.com/questions/3916386/mvc2-how-is-tag-different-to) – Jon 2012-02-21 06:56:33