Can two Web User Control have same File (.ascx) name within projec

G

Guest

Hello
I'm asking is it possible that two or more Web User Control have same file
(.ascx) name within same project? Namespace is different.

I got error message: "CS1595: 'ASP.EditForm_ascx' is defined in multiple
places;"
I know that I have two controls EditForm, in different namespaces, but with
same file name: "EditForm_ascx"

If it is of any importance, I use both user controls on same page.

Thanks
MilanB
 
K

Karl Seguin

In the @control directive, try to specify a separate classname for each..

<%@Control ClassName="EditForm" ... %>

<%@ Control ClassName="Blah" ... %>

Karl
 
H

Hans Kesting

MilanB said:
Hello
I'm asking is it possible that two or more Web User Control have same
file (.ascx) name within same project? Namespace is different.

I got error message: "CS1595: 'ASP.EditForm_ascx' is defined in
multiple places;"
I know that I have two controls EditForm, in different namespaces,
but with same file name: "EditForm_ascx"

If it is of any importance, I use both user controls on same page.

Thanks
MilanB

Yes, that is possible. You can have a classname appear in multiple
namespaces. In fact, that's the reason (or at least one of them)
to *have* namespaces.
Did you copy the first EditForm to get the second? You need to change
that namespace in two places: the codebehind *and* in the
<% @ Control %> directive.

Hans Kesting
 
G

Guest

I have tried, but it has not worked.
It is not a problem with namespace, but same file (.ascx) name.
When I give it different .ascx name, it works fine, no matter class names
are same (of course in different namespaces).

Any way thanks

I will give unique .ascx name.
MilanB
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top