期待';'或无效的'/'

时间:2011-03-23 18:50:40

标签: visual-studio-2010 asp.net-mvc-2 c#-4.0

这可能是我看不见的非常简单的事情,但是给出的错误是模糊地告诉我在哪里看。

这条线告诉我它期待';'

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>

我正在使用VS2010,MVC 2,我用此行调用一个parial视图(ascx文件)

<%Html.RenderPartial("problemPage");%>

然而,对于调用我得到的页面的这一行,错误CS1525:无效的表达式术语'/'

以下是部分视图(problemPage)中所谓的问题所在。

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>

<style type="text/css">
   a.navfooter:link {color: #19abdc; text-decoration: underline; }
   a.navfooter:visited {color: #19abdc; text-decoration: underline; }
   a.navfooter:hover {color: #19abdc; text-decoration: underline; }
   a.navquicklinks:active {color: #19abdc; } 
</style>

<table width="170" border="0" align="center">
  <tr>
    <td align="center"><h1><a href="../about-this.php"><img src="<%: Url.Content(~/Content/Images/banner_left.gif) %>" width="120" height="600" border="0" /></a></h1>
  <p>&nbsp;</p>
  </td>
<td align="center"><img src="<%: Url.Content(~/Content/Images/ss.gif) %>" width="11" height="11" /></td>
</tr>
</table>

我不知道页面中的无效'/'在哪里,并且期望';'已经在另一页,请帮忙。我觉得这应该是一个快速修复,但我还没有看到我的语法错误。

1 个答案:

答案 0 :(得分:2)

您的Url.Content(...)未包含在引号中。 E.G。

Url.Content(~/Content/Images/banner_left.gif)

应该是

Url.Content("~/Content/Images/banner_left.gif")
相关问题