Is there any way to create a Namespace alias in a .aspx file (not code-behind .aspx.cs).
For example... in a code-behind file an alias can be created as follows:
using MyPanel = System.Web.UI.WebControls.Panel;
In html source mode (Visual Studio) a Namespace can be imported as follows:
<%@ Import Namespace="System.Web.UI.WebControls" %>
What I need to do is something like the following:
<%@ Import Namespace="MyPanel = System.Web.UI.WebControls.Panel" %>
EDIT/UPDATE: Obviously that does not work. Is it possible some other way without using code-behind? Yes, it actually does work if you remove the whitespace (hat tip @Alex below). Example:
<%@ Import Namespace="MyPanel=System.Web.UI.WebControls.Panel" %>
Actually, your third example does work. You need to get rid of the white space. To get your ASPX namespace alias working, write the namespace declaration like this:
<%@ Import Namespace="MyPanel=System.Web.UI.WebControls.Panel" %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With