Reputation: 47945
I'm bored, on writing C# code on .ascx, to use this syntax :
<%
foreach (OriginalPackage.MyPack in OriginalPackage.MyPacks) {
}
%>
instead of
foreach (MyPack in MyPacks) {
}
writing the right using OriginalPackage;
So, is there a way to use the using
on the .ascx?
Upvotes: 2
Views: 5778
Reputation: 1500575
I haven't written an ascx file myself, but this documentation suggests you want:
<%@ Import namespace="OriginalPackage" %>
Upvotes: 6
Reputation: 499002
Use the @import
directive instead:
<%@ Import namespace="OriginalPackage" %>
Explicitly imports a namespace into an ASP.NET application file (such as a Web page, a user control, a master page, or a Global.asax file), making all classes and interfaces of the imported namespace available to the file. The imported namespace can be part of the .NET Framework class library or a user-defined namespace.
Upvotes: 16