Shortened namespace alias in aspx

Go To StackoverFlow.com

7

I have a using statement defined like this in codebehind:

using Name = Extremely.Long.And.Unwieldy.Namespace

I want to be able to do this in my aspx page:

<%=Name.Type %>

So far the best I have come up with is this:

<%=Namespace.Type %>

using the technique shown here.

Can I do any better?

2012-04-03 21:21
by Kev


18

Try this:

<%@ Import Namespace="Name=Extremely.Long.And.Unwieldy.Namespace" %>
2012-04-03 21:26
by Abe Miessler
This works. Thanks ; - Kev 2012-04-06 10:41


4

I found a reference to being able to use the import tag for namespace aliasing.

<%@ Import Namespace="myAlias=System.MyNamespace" %>

source

2012-04-03 21:27
by Rob Rodi
That link is broken - Andrew Morton 2018-03-13 10:06
Ads