Duplicate custom controls

T

Tumurbaatar S.

Hi!
I created some user control (ASCX) and it works fine.
The control is created one of subfolders of my project, so
its namespace looks like:
namespace myproject.subfolder1
{
public class route : System.Web.UI.UserControl
....

In another subfolder I also created second control, but
I used the 1st control as origin. Just copied the 1st control files
to the 2nd subfolder. After changed the 2nd control's namespace as:
namespace myproject.subfolder2
{
public class route : System.Web.UI.UserControl
....

Compilation works ok, but at run-time when I visit a page that contains
both of my controls, the server raises error:

Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.
Compiler Error Message: CS1595: 'ASP.route_ascx' is defined in multiple
places; using definition from
'd:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\myproject\4b10f33a\12f97037\2bgwzy1u.dll'
 
G

Guest

T,
Great job! You probably need to rebuild the web site to get rid of the
error. You could have just added your first control control to the second
control without copying any files to the sub folder.

Good Luck
DWS
 
T

Tumurbaatar S.

The files copied really. No virtual references.
How to rebuild whole site? In the VS IDE I see only
Build my project' or rebuild it. Neither helps.
So I excluded the newly created control from the project.
After, instead of copying, I created a new empty control but
with the same name. Rebuilt it and at the runtime it raises
the same error:
Compiler Error Message: CS1595: 'ASP.route_ascx' is defined in multiple
places

May be the problem is that controls must have different names
regardless of namespace?
I.e. 'route_ascx' should be unique across the project?
 
T

Tumurbaatar S.

I have no idea how it helps, but I've added ClassName attribute
with different values to both ASCX's Control directive, e.g.
ClassName="ImpRoute"
in one ASCX and ClassName="ExpRoute" in other one.
Now problem disappeared.
 

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,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top