Custom html helpers in MVC 4

后端 未结 2 1012
-上瘾入骨i
-上瘾入骨i 2021-01-01 19:53

I created the helper class

namespace SEM.API.Helpers
{
    public static class Navigation
    {
        public static string BuildSomething(this HtmlHelper h         


        
相关标签:
2条回答
  • 2021-01-01 20:17

    and added namespace to webconfig <add namespace="SEM.API.Helpers" />

    Make sure you did this in ~/Views/web.config and not in ~/web.config.

    Another thing to try is to add the @using directive to your view:

    @using SEM.API.Helpers
    @Html.BuildSomething()
    
    0 讨论(0)
  • 2021-01-01 20:21

    In addition, you should add to the ~/Areas/[Area name]Views/web.config the same string if Areas used.

    0 讨论(0)
提交回复
热议问题