2012-04-19 45 views
0

我正在運行asp.net MVC剃鬚刀。我試圖從我的視圖中的字符串中刪除引號。如何刪除asp.net MVC視圖中的特殊字符

所以我回到這個

"<p><strong>test</strong</p>" 

and my wanting this 

    <p><strong>test</strong></p> 

這裏是我已經試過:

@foreach (var post in Model) 
{ 
    var cont = post.postContent.Trim('"'); 

    <div class="post"> 
     <h2>@Html.ActionLink(post.postTitle, "Details", "Home", new { id = post.postId }, null)</h2> 

     @cont 

     <p>@post.postDate</p> 
    </div> 
} 
+0

'String.Replace()'? – SouthShoreAK 2012-04-19 19:06:39

回答

0

你看到HTML編碼的文本(當您查看源),其中@Cont顯示?如果是,請嘗試

@Html.Raw(cont) 
+0

謝謝修復它! – ironman 2012-04-19 19:56:14