User Controls with same name on same page

R

rgparkins

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\Temporary 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.Customer.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.Notes.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.Address.List"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
 
C

Cowboy \(Gregory A. Beamer\)

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!
*************************************************
 
R

rgparkins

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
 
G

Guest

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
 

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

Top