473,289 Members | 1,952 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,289 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 1844
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...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.