Using classlibrary that extends strings in view for mvc 3
I have a classlibrary where I have extended string with some functions that returns email and url links and so on. And I have this in web.config
<add namespace="TestPro开发者_如何学编程ject.Helpers" />
Somehow the extended functions doesnt show when I use them in razor views.
What might be wrong here? if I have them in controller with using-statement they work.
/Lasse
You should add the namespace in web.config file located inside the views folder under system.web.webPages.razor
section. If still there is no intellisense use the Razor's @using <your extensions namespace>
inside the Razor view page.
Edit: Dont forgot to close and reopen the .cshtml for the intellisense to catch up.
精彩评论