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

This probably applies to non-MVC as well. But is it possible to use the 'using' expression in my aspx views?

The reason is because I have links to resource help files for localized strings. And some of these resource links are quite long - it really clutters my code.

Since most of the time these resources are in the namespace, especially for presentation, I just wanted to add โ€œUse Resources. Thisโ€ at the top of the page. I can't seem to do this - is there a way?

thank

+60
c # asp.net-mvc
Nov 08 '09 at 17:07
source share
1 answer

You mean how

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

Also inside the root <configuration> web.config file 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> 
+131
Nov 08 '09 at 17:13
source share



All Articles