4
有沒有一種方法,使在Asp.Net MVC幫手包裝其他HTML這樣的:Asp.Net MVC的自定義控件 - 集裝箱
<div class="lightGreyBar_left">
<div class="lightGreyBar_right">
<!--Content-->
<h3>
Profiles</h3>
<div class="divOption">
<%= Html.ActionLinkWithImage("Create new", "add.png", Keys.Actions.CreateProfile, "add")%>
</div>
<!--Content-->
</div>
</div>
讓助手將呈現包含傳遞給的div和內容輔助方法作爲參數。
「WrapThis」需要在一個靜態類..這不是很明顯在這個例子中。 – LarryBud 2017-05-19 18:42:40
看完後這是不正確的。這樣做會將內容寫入頁面的頂部。它應該是helper.ViewContext.Writer.Write(...)。此外,WrapThis需要處於靜態類中,而MyContainer方法應該將HtmlHelper作爲參數,而不是HttpResponseBase。 – LarryBud 2017-05-19 18:55:07