Is it possible to use the 'using' statement in my aspx views? (ASP.NET MVC)

后端 未结 1 1554
野趣味
野趣味 2020-12-07 23:44

This likely applies to non MVC too. But, Is it possible to use the \'using\' statement in my aspx views?

Reason is that I have the pages reference resource files fo

相关标签:
1条回答
  • 2020-12-08 00:24

    Do you mean like

    <%@ Import namespace="MyProgram.MyNamespace" %>
    

    Also, inside the root <configuration> tag of web.config, you can add:

    <system.web>    
        <pages>
           <namespaces>
              <add namespace="System" />
              <add namespace="System.Collections" />
              <add namespace="System.Collections.Specialized" />
              <add namespace="System.Configuration" />
              <add namespace="System.Text" />
              <!-- etc -->
           </namespaces>
        </pages>
    </system.web>
    
    0 讨论(0)
提交回复
热议问题