我正在尝试将 Facebook 的评论计数添加到我的网站。我正在使用 Facebook 评论插件,并希望在我的按钮中输出当前计数。但是,我收到来自 Razor 的解析器错误。出于某种原因,Razor 将-count
结束标记解释为 C# 代码。
“/”应用程序中的服务器错误。
解析器错误
说明:解析服务此请求所需的资源时出错。请查看以下特定的解析错误详细信息并适当地修改您的源文件。
Parser Error Message: Encountered end tag "div" with no matching start tag.
Are your start/end tags properly balanced?
Source Error:
Line 42: </div>
Line 43: </div>
Line 44: </div>
Line 45: }
Source File: /Views/Home/Index.cshtml Line: 44
Version Information: Microsoft .NET Framework
Version:4.0.30319; ASP.NET Version:4.0.30319.225
这是我的观点:
@using asdf.WebUI.Helpers
@model IEnumerable<asdf.WebUI.Models.PostModel>
@{
ViewBag.Title = String.Format("adsf - {0}", DynamicContentHelper.GetDynamicHomePageQuip());
}
@foreach (var post in Model)
{
<div class="post">
<a href="@Url.Action("Details", "Post", new { id = post.PostId })">
<img class="post-img" src="@post.ImageUrl" alt="@post.Description" title="@post.Description" />
</a>
<div class="detail">
<div class="information">
<h3 class="score">PUNTAJE: <span>234</span></h3>
<div class="vote">
<button type="button" class="btn btn-success"><i class="icon-thumbs-up icon-white"></i> ME GUSTA</button>
<button type="button" class="btn btn-danger"><i class="icon-thumbs-down icon-white"></i> NO ME GUSTA</button>
<a class="btn btn-info comment-link" href="@Url.Action("Details", "Post", new { id = post.PostId })">
<-- ERROR FIRES HERE!!!! -->
<i class="icon-comment icon-white"></i> COMENTARIOS <fb:comments-count href="http://asdf.net/bolivia/"/></fb:comments-count>
</a>
</div>
<div class="post-description">
<blockquote class="pull-right">
<p>@post.Description</p>
<small>imagen subida por: <a href="@Url.Action("Details", "Post", new { id = post.PostId })">@post.UserName</a></small>
</blockquote>
</div>
</div>
<div class="social">
<a href="#" id="shareFacebook" data-popup-height="380" data-popup-width="660" data-url="http://www.facebook.com/sharer.php?u=http://www.asdf.net/bolivia/@post.PostId">
<img src="@Url.Content("~/Public/assets/images/FB-share.png")"/>
</a>
<a href="#" id="shareTwitter" data-popup-height="270" data-popup-width="600" data-url="http://twitter.com/intent/tweet?url=http://www.asdf.net/bolivia/@post.PostId&text=@post.Description">
<img src="@Url.Content("~/Public/assets/images/TW-share.png")"/>
</a>
</div>
</div>
</div>
}