Problem recognizing html helpers in asp.net mvc 3 razor

后端 未结 4 722
眼角桃花
眼角桃花 2021-01-05 00:20

This is what my Html helper looks like:

namespace WebApp.WebUI
{
    public static class HtmlExtensions
    {

            public static MvcHtmlString Genera         


        
4条回答
  •  梦毁少年i
    2021-01-05 00:29

    You could add:

    @using WebApp.WebUI
    

    on the top of your Razor view.

    And if you want to reuse this helper among many different views to avoid adding the using clause everytime you could add it to the section of the ~/Views/web.config file:

    
        
        
            
                
                
                
                
                
            
        
    
    

    After doing this make sure you recompile and reopen the Razor view for the Intellisense to have time to pick it up.

提交回复
热议问题