Hi,
I agree with Victor.
When ASP .NET parse the application, by default it will create the class of
the corresponding control with the name of the control¡¯s file name. If the
file names of the controls are the same, classes with the same name will be
created and the error will occur. If you go to the folder
Windows\Microsoft.NET\Framework\<version>\Temporary ASP.NET Files\<random
number>, you will find several *.vb or *.cs files. These files are the
results of the parsing. You will notice that in these .VB or .CS files,
Description_ascx class may have been defined several times.
To resolve the issue, add a ¡°ClassName=¡± attribute to the @Control
reference in the ascx :
<%@ Control ClassName="myclass1" Language="vb"¡
Name the controls different names as ClassName. We don¡¯t need to modify
the aspx file.
Best regards,
Bradley Jiang
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
|From: "Michael Tissington" <
[email protected]>
|Subject: Multiple controls, Same name
|Date: Sun, 13 Jul 2003 21:26:49 -0700
|Lines: 25
|X-Priority: 3
|X-MSMail-Priority: Normal
|X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
|X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
|Message-ID: <#
[email protected]>
|Newsgroups:
microsoft.public.dotnet.framework.aspnet.buildingcontrols,microsoft.public.d
otnet.framework.aspnet.webcontrols
|NNTP-Posting-Host: antelope.oaklodge.com 63.67.71.5
|Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
|Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:13074
microsoft.public.dotnet.framework.aspnet.buildingcontrols:6570
|X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingcontrols
|
|I have created multiple controls with the same name but in different
|namespaces (each one in a different folder)
|
|I now need to reference these controls on a single web page but when I try
|to browse the page I get errors saying the the control is defined more than
|once.
|
|How do I make each reference specific?
|
|This is what I have at the moment
|
|<@ Register TagPrefix="uc1" TagName="Test1" Src="/Test1/Description.ascx"
|%>
|<@ Register TagPrefix="uc1" TagName="Test2" Src="/Test2/Description.ascx"
|%>
|<@ Register TagPrefix="uc1" TagName="Test3" Src="/Test3/Description.ascx"
|%>
|
|--
|Michael Tissington
|Oaklodge Technologies
|
http://www.oaklodge.com/technology
|
|
|
|