开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜