470,631 Members | 1,704 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,631 developers. It's quick & easy.

User Controls with same name on same page

Hi

This has been asked before but with no resolution so I am putting it
out there again in case someone has an answer.

2 user controls with same name List.ascx but different namespace, and I
drag them onto the page. When the page is displayed I get

Compiler Error Message: CS1595: 'ASP.List_ascx' is defined in multiple
places; using definition from
'c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temp orary ASP.NET
Files\dev\f79c2775\db5cf4f4\tfui8-no.dll'

Ok fine, I will change the Namespace, but still the same problem, does
anyone know why this is, is this my understanding of what I am doing or
a "intricacy" of .NET, I have placed different namespaces on one of the
lists and still the same error. See below my code, any help appreciated

Regards

Richard

THE WEB Page

<%@ Register TagPrefix="tsd" Namespace="TouchScreenData.MasterPages"
Assembly="TouchScreenDataMasterPages" %>
<%@ Register TagPrefix="uc1" TagName="NoteList"
Src="../../../Controls/Customer/Notes/List.ascx" %>
<%@ Register TagPrefix="uc2" TagName="List"
Src="../../../Controls/Customer/Address/List.ascx" %>
<%@ Register TagPrefix="uc1" TagName="View"
Src="../../../Controls/Customer/View.ascx" %>
<%@ Page language="c#" Codebehind="View.aspx.cs"
AutoEventWireup="false"
Inherits="TouchScreenData.Web.Private.Admin.Custom er.View" %>
<tsd:masterpage id="MPContainer" PageKeywords="Customer,View"
PageDescription="Page that lets an administrator view a customer on the
database"
PageTitle="Mallett: Add Customer" PageCss="admin.css"
masterpagefile="AdminTemplate.ascx" runat="server">
<H4>View Client Details</H4>
<uc1:View id="View1" runat="server"></uc1:View>
<uc1:NoteList id="NoteList" runat="server"></uc1:NoteList>
<uc2:List id="List2" runat="server"></uc2:List>
</tsd:masterpage>

The Notes list

<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="List.ascx.cs"
Inherits="TouchScreenData.Web.Controls.Customer.No tes.List"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
The Address list

<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="List.ascx.cs"
Inherits="TouchScreenData.Web.Controls.Customer.Ad dress.List"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>

May 16 '06 #1
3 1765
If you insist on naming everything the same, you will have to build this
portion of the page via CodeBehind and not drag and drop. This means you
lose designer support. In CodeBehind you can easily have multiple controls
with the same name by simply qualifying them.

If you need GUI magic, I know of no other way to achieve Nirvana except to
give the controls unique names.

--
Gregory A. Beamer

*************************************************
Think Outside the Box!
*************************************************
<rg*******@hotmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
Hi

This has been asked before but with no resolution so I am putting it
out there again in case someone has an answer.

2 user controls with same name List.ascx but different namespace, and I
drag them onto the page. When the page is displayed I get

Compiler Error Message: CS1595: 'ASP.List_ascx' is defined in multiple
places; using definition from
'c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temp orary ASP.NET
Files\dev\f79c2775\db5cf4f4\tfui8-no.dll'

Ok fine, I will change the Namespace, but still the same problem, does
anyone know why this is, is this my understanding of what I am doing or
a "intricacy" of .NET, I have placed different namespaces on one of the
lists and still the same error. See below my code, any help appreciated

Regards

Richard

THE WEB Page

<%@ Register TagPrefix="tsd" Namespace="TouchScreenData.MasterPages"
Assembly="TouchScreenDataMasterPages" %>
<%@ Register TagPrefix="uc1" TagName="NoteList"
Src="../../../Controls/Customer/Notes/List.ascx" %>
<%@ Register TagPrefix="uc2" TagName="List"
Src="../../../Controls/Customer/Address/List.ascx" %>
<%@ Register TagPrefix="uc1" TagName="View"
Src="../../../Controls/Customer/View.ascx" %>
<%@ Page language="c#" Codebehind="View.aspx.cs"
AutoEventWireup="false"
Inherits="TouchScreenData.Web.Private.Admin.Custom er.View" %>
<tsd:masterpage id="MPContainer" PageKeywords="Customer,View"
PageDescription="Page that lets an administrator view a customer on the
database"
PageTitle="Mallett: Add Customer" PageCss="admin.css"
masterpagefile="AdminTemplate.ascx" runat="server">
<H4>View Client Details</H4>
<uc1:View id="View1" runat="server"></uc1:View>
<uc1:NoteList id="NoteList" runat="server"></uc1:NoteList>
<uc2:List id="List2" runat="server"></uc2:List>
</tsd:masterpage>

The Notes list

<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="List.ascx.cs"
Inherits="TouchScreenData.Web.Controls.Customer.No tes.List"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
The Address list

<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="List.ascx.cs"
Inherits="TouchScreenData.Web.Controls.Customer.Ad dress.List"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>

May 16 '06 #2
Hi Gregory

Hhmmm, I cant see why this is not supported, is it really that
inconcievable to name your controls the same name remembering they are
in fact in different namespaces. Maybe I am missing something. Anyway
in the meantime I have in fact renamed one of my lists. On the surface
this looks like a bug in MS but not sure, maybe I need educating :)

Many thanks

Richard

May 16 '06 #3
You can call it a "bug" if you want to, but the lesson learned is quite
clear: give your controls unique names, not just at the namespace level, but
the class level as well.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"rg*******@hotmail.com" wrote:
Hi Gregory

Hhmmm, I cant see why this is not supported, is it really that
inconcievable to name your controls the same name remembering they are
in fact in different namespaces. Maybe I am missing something. Anyway
in the meantime I have in fact renamed one of my lists. On the surface
this looks like a bug in MS but not sure, maybe I need educating :)

Many thanks

Richard

May 16 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Alphonse Giambrone | last post: by
6 posts views Thread by martin | last post: by
1 post views Thread by Kris van der Mast | last post: by
2 posts views Thread by rn5a | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.