473,385 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 1847
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Alphonse Giambrone | last post by:
I have a web form with 2 user controls on it (UC1 and UC2). Each control has a bound datagrid with textboxes in the footer to add a new row. There are also requiredfieldvalidators in each footer....
6
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header"...
1
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a...
1
by: Kris van der Mast | last post by:
Hi, been a while since I posted a question myself instead of trying to help others out. I'm refactoring an existing web app that uses dynamic loading of user controls and a lot of...
6
by: Steve Booth | last post by:
I have a web form with a button and a placeholder, the button adds a user control to the placeholder (and removes any existing controls). The user control contains a single button. I have done all...
9
by: Alan Silver | last post by:
Hello, I have a user control which I am trying to load dynamically, but am running into problems. I think the problem is because I have two .ascx files that refer to the same .ascx.cs file. A...
9
by: Gummy | last post by:
Hello, I created a user control that has a ListBox and a RadioButtonList (and other stuff). The idea is that I put the user control on the ASPX page multiple times and each user control will...
2
by: rn5a | last post by:
Assume that a user control (MyUC.ascx) encapsulates 2 TextBoxes with the IDs 'txt1' & 'txt2' respectively. To use this user control in an ASPX page, the following Register directive will be...
2
by: ccbalapatel | last post by:
Hi, We have recently converted our code to ASP.NET 2.0. We have an user control that is embedded inside the page. The user control has a link button and the event handler for the link button is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.