Multiple controls with same ID error

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
garyb
Ensign (ENS)
Ensign (ENS)
Posts: 6
Joined: Tue Jan 06, 2009 3:41 pm

Multiple controls with same ID error

Post by garyb » Sat Apr 18, 2009 3:09 pm

Hello,

When I'm browsing my catalog it gives me the following error:

Multiple controls with the same ID’C2’ were found. FindControl requires that controls have unique IDs.


I searched the messageboard and found the following so I backed up my database and tired this query:

DELETE FROM ac_CatalogNodes
WHERE (CAST(ac_CatalogNodes.CategoryId as varchar) + '/' +
CAST(ac_CatalogNodes.CatalogNodeId as varchar) + '/' +
CAST(ac_CatalogNodes.CatalogNodeTypeId as varchar))
IN ( SELECT (CAST(CN.CategoryId as varchar) + '/' +
CAST(CN.CatalogNodeId as varchar) + '/' +
CAST(CN.CatalogNodeTypeId as varchar)) as ID
FROM ac_CatalogNodes CN inner join ac_Categories C ON
CN.CatalogNodeId=C.CategoryId
WHERE CN.CatalogNodeTypeId=0 AND CN.CategoryID <> C.ParentID
)

but it said that 0 rows were affected. I haven’t been manually editing my database so I’m not sure what the problem is. BTW the version I am running is:

PLATFORM: ASP.NET
VERSION: 7.0.2
BUILD: 11659

Thanks in advanced for any help.

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Multiple controls with same ID error

Post by jmestep » Sun Apr 19, 2009 9:03 am

Have you customized the page and what page is it?
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

garyb
Ensign (ENS)
Ensign (ENS)
Posts: 6
Joined: Tue Jan 06, 2009 3:41 pm

Re: Multiple controls with same ID error

Post by garyb » Mon Apr 20, 2009 8:39 pm

The page isn't customized. The page is Admin/Catalog/Browse.aspx

afm
Captain (CAPT)
Captain (CAPT)
Posts: 339
Joined: Thu Nov 03, 2005 11:52 pm
Location: Portland, OR
Contact:

Re: Multiple controls with same ID error

Post by afm » Mon Apr 20, 2009 9:12 pm

Does the error occur when you cause a postback or a callback (i.e. send something back to the server) or when you first load the page? If the former, when you view the page source with your browser, what 2 controls have the "C2" ID?
Andy Miller
Structured Solutions

Shipper 3 - High Velocity Shipment Processing

garyb
Ensign (ENS)
Ensign (ENS)
Posts: 6
Joined: Tue Jan 06, 2009 3:41 pm

Re: Multiple controls with same ID error

Post by garyb » Mon Apr 20, 2009 10:06 pm

Only on postback. It doesn't happen with all categories.

afm
Captain (CAPT)
Captain (CAPT)
Posts: 339
Joined: Thu Nov 03, 2005 11:52 pm
Location: Portland, OR
Contact:

Re: Multiple controls with same ID error

Post by afm » Mon Apr 20, 2009 10:57 pm

When you view the page source with your browser, which two controls have the "C2" ID?
Andy Miller
Structured Solutions

Shipper 3 - High Velocity Shipment Processing

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Multiple controls with same ID error

Post by jmestep » Tue Apr 21, 2009 6:13 am

Do any of you categories have apostrophes in the name? Sometimes that causes weird actions.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

garyb
Ensign (ENS)
Ensign (ENS)
Posts: 6
Joined: Tue Jan 06, 2009 3:41 pm

Re: Multiple controls with same ID error

Post by garyb » Tue Apr 21, 2009 10:46 am

The all look like they have unique id's

Code: Select all

<div class="treeNode"><img src="../../App_Themes/AbleCommerceAdmin/Images/plus.gif" border="0" align="absmiddle" /><a id="ctl00_MainContent_C1" href="javascript:__doPostBack('ctl00$MainContent$C1','')">PRESCHOOL LEVEL<br /> MONTESSORI MATERIALS & CURRICULUM</a></div>
<div class="treeNode"><img src="../../App_Themes/AbleCommerceAdmin/Images/plus.gif" border="0" align="absmiddle" /><a id="ctl00_MainContent_C2" href="javascript:__doPostBack('ctl00$MainContent$C2','')">JUNIOR ELEMENTARY<br /> MONTESSORI MATERIALS & CURRICULUM</a></div>
<div class="treeNode"><img src="../../App_Themes/AbleCommerceAdmin/Images/plus.gif" border="0" align="absmiddle" /><a id="ctl00_MainContent_C3" href="javascript:__doPostBack('ctl00$MainContent$C3','')">ADVANCED ELEMENTARY <br />MONTESSORI MATERIALS & CURRICULUM</a></div>
<div class="treeNode"><img src="../../App_Themes/AbleCommerceAdmin/Images/plus.gif" border="0" align="absmiddle" /><a id="ctl00_MainContent_C16" href="javascript:__doPostBack('ctl00$MainContent$C16','')">ACP TESTS FOR THE<br /> PRESCHOOL LEVELS</a></div>

<div class="treeNode"><img src="../../App_Themes/AbleCommerceAdmin/Images/plus.gif" border="0" align="absmiddle" /><a id="ctl00_MainContent_C17" href="javascript:__doPostBack('ctl00$MainContent$C17','')">ACP TESTS FOR THE <br />JUNIOR ELEMENTARY LEVELS</a></div>
<div class="treeNode"><img src="../../App_Themes/AbleCommerceAdmin/Images/plus.gif" border="0" align="absmiddle" /><a id="ctl00_MainContent_C18" href="javascript:__doPostBack('ctl00$MainContent$C18','')">ACP TESTS FOR THE <br />ADVANCED ELEMENTARY LEVELS</a></div>
<div class="treeNode"><img src="../../App_Themes/AbleCommerceAdmin/Images/plus.gif" border="0" align="absmiddle" /><a id="ctl00_MainContent_C19" href="javascript:__doPostBack('ctl00$MainContent$C19','')">ALBANESI CURRICULUM PROGRAMS</a></div>
<div class="treeNode"><img src="../../App_Themes/AbleCommerceAdmin/Images/plus.gif" border="0" align="absmiddle" /><a id="ctl00_MainContent_C23" href="javascript:__doPostBack('ctl00$MainContent$C23','')">Special Orders </a></div>
<div class="treeNode"><img src="../../App_Themes/AbleCommerceAdmin/Images/plus.gif" border="0" align="absmiddle" /><a id="ctl00_MainContent_C24" href="javascript:__doPostBack('ctl00$MainContent$C24','')">KB</a></div>
</div>

Also no commas

afm
Captain (CAPT)
Captain (CAPT)
Posts: 339
Joined: Thu Nov 03, 2005 11:52 pm
Location: Portland, OR
Contact:

Re: Multiple controls with same ID error

Post by afm » Tue Apr 21, 2009 11:00 am

I agree...no duplicates visible. Any chance there is an ID with "C2" in a part of the page you did not show us?

Does it happen with all browsers? For example, if you normally use Internet Explorer, does it happen with FireFox?
Andy Miller
Structured Solutions

Shipper 3 - High Velocity Shipment Processing

garyb
Ensign (ENS)
Ensign (ENS)
Posts: 6
Joined: Tue Jan 06, 2009 3:41 pm

Re: Multiple controls with same ID error

Post by garyb » Tue Apr 21, 2009 11:25 am

No other parts that I can see, but I think some code is coming with the post back, you know when it expands the category tree.

Just checked IE, same errors on the same categories.

How are the ID's assigned?

afm
Captain (CAPT)
Captain (CAPT)
Posts: 339
Joined: Thu Nov 03, 2005 11:52 pm
Location: Portland, OR
Contact:

Re: Multiple controls with same ID error

Post by afm » Tue Apr 21, 2009 2:03 pm

The ID's are created in layers: first AbleCommerce assigns the "C2" part and then ASP.NET prepends the "MainContent_" parts. When your browser causes a postback, it goes in reverse: ASP.NET uses the "MainContent_" part to figure out which panel the control belongs to and then uses the "C2" part to figure out which control. The error message means that ASP.NET see 2 controls named "C2" in the same panel.

Obviously it does not normally occur and I don't know what would cause it. If it were my site, I think I might start by making sure all critical Windows updates are installed and then use a tool like Fiddler to look at the postbacks.
Andy Miller
Structured Solutions

Shipper 3 - High Velocity Shipment Processing

Post Reply