开发者

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

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

Reason is that I hav开发者_运维问答e the pages reference resource files for localised strings. And some of these resource references are quite long - it's really cluttering my code.

Since most of the time these resources are in a namespace specifially for the view, I'd just like to put a 'using Resources.This.that' at the top of the page. I don't seem to be able to though - is there a way?

Thanks


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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜