0

I'm trying to call a custom HtmlHelper's extension method from a partial view

<%: Html.ToRelativeTime(Model.CreatedDate) %>

and I get this error:

CS1061: ...does not contain a definition for 'ToRelativeTime' and no extension method 'ToRelativeTime' accepting a first argument of type 'System.Web.Mvc.HtmlHelper...could be found (are you missing a using directive or an assembly reference?)

and I'm calling the render code as this:

<% Html.RenderPartial("Product", Model.Product); %>

P.S: When I type Html., there is no intellesince.

Ken D
  • 5,880
  • 2
  • 36
  • 58

1 Answers1

2

Try to add namespace reference of your extension to the partial view where you trying to use your custom extension

<%@ import namespace='your namespace' %>

also here you may find a useful information

Community
  • 1
  • 1
Samich
  • 29,157
  • 6
  • 68
  • 77