Multiple assemblies, one prefix in aspx page?

W

Welman Jordan

I have developed several assemblies for my own site.

They are in different namespaces, e.g.

MySite.Web;
MySite.Web.UI;
MySite.Web.UI.HtmlControls;
MySite.Web.UI.WebControls;

I would like to do this:
In an aspx page, I can use one prefix for those three namespaces.

<mysite:TextBox runat="server">
<mysite:HtmlTextBox runat="server">

The textbox class belongs to the MySite.Web.UI.HtmlControls
namespace, however, the HtmlTextBox belogs to the
MySite.Web.UI.WebControls namespace.

I don't know how to write the directives in the aspx file.
Using <%@ Register ... %> does not work.

Any way?
 
W

Welman Jordan

Sorry, @ Import does not work.
I have already tried that.

<@ Import namespace="MySite.Web" %>
<@ Import namespace="MySite.Web.UI" %>
<@ Import namespace="MySite.Web.HtmlControls" %>

<mysite:TextBox runat="server"/>

The compiler said that it was an unknown server tag.


: Welman,
:
: Take a look at the <%@ Imports directive.
:
: -- Alex PApadimoulis
:
: : > I have developed several assemblies for my own site.
: >
: > They are in different namespaces, e.g.
: >
: > MySite.Web;
: > MySite.Web.UI;
: > MySite.Web.UI.HtmlControls;
: > MySite.Web.UI.WebControls;
: >
: > I would like to do this:
: > In an aspx page, I can use one prefix for those three namespaces.
: >
: > <mysite:TextBox runat="server">
: > <mysite:HtmlTextBox runat="server">
: >
: > The textbox class belongs to the MySite.Web.UI.HtmlControls
: > namespace, however, the HtmlTextBox belogs to the
: > MySite.Web.UI.WebControls namespace.
: >
: > I don't know how to write the directives in the aspx file.
: > Using <%@ Register ... %> does not work.
: >
: > Any way?
: >
: >
:
:
 
A

Alex Papadimoulis

Welman,

Now I get what you're talking about. You mentioned you tried @Register, but
did you do:

<%@ Register Tagprefix="mysite" Namespace="MyCompany:MySite.Web"
Assembly="MyAssembly1" %>
<%@ Register Tagprefix="mysite" Namespace="MyCompany:MySite.Web"
Assembly="MyAssembly2" %>
<%@ Register Tagprefix="mysite" Namespace="MyCompany:MySite.Web.UI"
Assembly="MyAssembly3" %>
<%@ Register Tagprefix="mysite"
Namespace="MyCompany:MySite.Web.HtmlControls" Assembly="MyAssembly4" %>

now, you should be able to do ...
<mysite:MyControl ... /> -- where myControl is an any three namespaces

-- Alex Papadimoulis
 
W

Welman Jordan

Alex,

Thanks for replying.
Yep, I have already tried that thing as well before posting this
thread.

<%@ Register TagPrefix="MySite" Namespace="MySite.Web"
Assembly="MySite.Web" %>
<%@ Register TagPrefix="MySite" Namespace="MySite.Web.UI"
Assembly="MySite.Web.UI" %>

The complier throws a parser error:
The 'MySite' prefix has already been mapped to the namespace
'MySite.Web'

Thus, neither did this work.
Perhaps, this is a "Mission Impossible" in .net :p

Thanks.
W. Jordan
 
R

Rene

I had the same problem, but after stopping the 'world wide web
publishing service' in service, building the application and starting
the service, the problem was solved!

It look's like a locking of some dll when the service is running!

Greetz,


Rene
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top