public MvcHtmlString PopupList(List<string> myList)
{
TagBuilder ulBuilder = new TagBuilder("ul");
foreach (var item in myList)
{
TagBuilder liBuilder = new TagBuilder("li");
liBuilder.InnerHtml =item;
ulBuilder.InnerHtml += liBuilder;
}
MvcHtmlString.Create(ulBuilder.ToString());
}
當我有「myList中」具有HTML標籤的話,我想不能轉換到HTML輸出不允許在MVC幫手擴展特定文本的轉換
通過函數的返回類型轉換爲'IHtmlString'使用'HttpUtility.HtmlEncode'的項目 –