Groups | Blog | Home
all groups > asp.net building controls > june 2005 >

asp.net building controls : Strange Error when viewing page



Ken Tucker [MVP]
6/21/2005 2:14:01 AM
Hi,

If you are adding the control to the webpage via code do not add
it again when the page is posting back.

If not me.postback then
' add the control here
end if

Ken
----------------------------

[quoted text, click to view]
Nathan Sokalski
6/21/2005 4:02:12 AM
When I view my index.aspx page any time after the first time, I recieve the
following error:

[HttpException (0x80004005): Multiple controls with the same ID
'TitleBanner:_ctl0' were found. Trace requires that controls have unique
IDs.]
System.Web.TraceContext.AddNewControl(String id, String parentId, String
type, Int32 viewStateSize) +313
System.Web.UI.Control.BuildProfileTree(String parentId, Boolean
calcViewState) +201
System.Web.UI.Control.BuildProfileTree(String parentId, Boolean
calcViewState) +263
System.Web.UI.Control.BuildProfileTree(String parentId, Boolean
calcViewState) +263
System.Web.UI.Control.BuildProfileTree(String parentId, Boolean
calcViewState) +263
System.Web.UI.Page.ProcessRequestMain() +1633

TitleBanner is a user control on my page. Because I do not recieve this
error the very first time I view the page after compiling it, ASP.NET is
obviously remembering the control after I view the page the first time. I
find this error strange because _ctl0 is an automatically generated name, so
how can there be two controls with that name? I also find it strange that
the error only seems to occur on my index.aspx page, even though the control
is used in exactly the same way (same parameters and properties) on another
page in the same directory, and it does not give me an error there even when
I view it multiple times. Why might this be happening, and what might I be
able to do to fix it? Thanks.
--
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/

Cor Ligthert
6/21/2005 11:02:55 AM
Nathan,

First question,
Are you dynamicly building controls?

Cor

AddThis Social Bookmark Button