0
我已经在RazorEngine模板如下:RazorEngine - 如何使用我自己的HTML助手?
@using WAND.Helpers
@model Tour.Entities.Accommodation
<p>
You can view your WAND accommodation home page by @Html.HomepageActionLink("Accommodation","clicking here",@Model.AccommodationId)
</p>
的HomePageActionLink是一个帮助我写的,看起来在某种程度上,这样的:
public static MvcHtmlString HomepageActionLink(this HtmlHelper helper, string serviceProviderType, string linkText, int idValue)
{
...
return new MvcHtmlString(link);
}
的问题是,当我运行此,我收到一条错误消息:
More details about the error: - error: (64, 60) The name 'Html' does not exist in the current context
有没有办法让这个工作?
哪条线给你错误? – DavidG
你是否在视图中添加了一个'using'语句给你的助手所在的程序集(或者在'web.config'文件中添加了程序集)? –
@DavidG - 我打电话给Html.HomepageActionLink的行 –