After updating to the 1/23 release of AJAX/CTP/AjaxToolKit I started receiving different versions of the following javascript error message:
> Two components with the same id ‘{0}’ can’t be added to the application
an example of the actual error message:
> Error: Sys.InvalidOperationException: Two components with the same id 'ctl00_cphMain_acNounPopupBehavior' can't be added to the application.
I would get this error message for every instance of an AutoCompleteExtender that existed in the UpdatePanel I was working in. The error would happen when called an OnClick event for a button that was also in that UpdatePanel. After the error messages
occurred, the AutoCompleteExtenders would stop functioning. If I tried to use one of the AutoCompleteExtenders I would get the following javascript error:
> Error: 'this._popupBehavior' is null or not an object.
I searched up and down these forums for a solution and did see a few other users having similar problems with extenders + update panels and receiving the "two components" error message but I found no working solutions. I tried to recreate the error with
a from scratch AJAXWebApplication and was unable to. I copied the working code form my from scratch app to my application with the error and it started experiencing the same error. I looked through the web.config file about 10 times before running it through
WinMerge to compare and found the following difference:
> <compilation debug="false"> (on the working version)
> <compilation debug="true"> (on the non-working version)
I changed debug to false for my primary application and it fixed the "two component" error message. I don't know if this will fix the other errors that were similar to mine but I wanted to post this in hopes it might. Also, looking back over the migration
docks I did find this:
> Move settings that determine whether to render the debug or the retail version of JavaScript code out of the page and into the Web.config file, as shown here:
I was previously running in true debug mode without issues so I never considered this to be an important command. Obviously something changed in the latest release that is affected by debug = true.
The debug or release versions of script are handled through the ScriptManager that makes a determination from the compilation section in (app root) config, the deploymentmode section in config (wins in all cases), and the local ScriptMode on the ScriptManager.
It does not use the Page directive's debug setting.
When you use the debug scripts, then exception messages are possiblly thrown, but would not be the case in the 'release'; versions of the script. This is because the debug scripts are built for development scenarios, but the release is trimmed for performance
reasons. Even though you see the exception error disappear in the debug=false case, the issue remains.
Essentially, the client-side type generated by the extender(s) are attempting to add more than one type with the same (unique) ID to the Sys.Application. This is the result of the ID specified on that type. Can you post your sample code first for us to look
at to start delving deeper?
Simon
This posting is provided "AS IS" with no warranties, and confers no rights.
today I installed AJAX.NET 1.0 RTM and now experiencing the same problem, probably a bug in AutoCompleteExtender.
I have AutoCompleteExtender inside UpdatePanel, which is inside one of my WizardSteps. When I switch WizardSteps and return to the step where AutoCompleteExtender is, I get this error.
Please help, many aspx pages in my project are now unusable.
I have the same problem. At first I was happy the AutocompleteExtender in the Toolkit would stop the message with the "secure and non-secure items", which appeared using SSL previously.
Now I don't have this issue anymore, but the problem with the two ids. Actually it's annoying to falling from one problem to the other with every "release"...
My code and settings are as following:
-Using Master Pages
-Using AutocompleteExtender within ascx user control
-within user control is a scriptmanagerproxy
-the I have an UpdatePanel containing the textbox and extender
-the application is set to debug=true -the website is running iis 6.0 locally (not asp development server) -site is allowed to be updateable (this setting is historic since the rc1 release had a major problem with "release" compilation)
Any help appreciated,
Chris
Never underestimate the power of stupid people in large groups
I'll try as soon as possible to recompile it...nevertheless.
Wouldn't ist be much easier to "bugfix" the toolkit itself. This seems to be a "little" correction and Toolkit doesn't seem to have such a strict release management as AJAX-Extensions...
Did anybody report the error to those guys as well?
kind regards,
Chris
Never underestimate the power of stupid people in large groups
Can you post your sample code first for us to look at to start delving deeper?
I am using the Ajax Ext, CTP and AjaxControlToolkit released 1/23/2007. I was able to fix the problem using the corrected code here: http://forums.asp.net/thread/1546666.aspx. Hopefully this source code will help you resolve the issue.
using System; using System.Web; using System.Collections; using System.Collections.Generic; using System.Web.Services; using System.Web.Services.Protocols;
/// <summary> /// Summary description for ws1 /// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class ws1 : System.Web.Services.WebService
{
public ws1 ()
{
//Uncomment the following line if using designed components //InitializeComponent();
}
[WebMethod]
public string HelloWorld()
{
return "Hello World"; }
[WebMethod] public string[] GetList() { List<string> items = new List<string>(5); items.Add("one"); items.Add("two"); items.Add("three"); items.Add("four"); items.Add("five"); return items.ToArray(); } }
web.config
<configuration> <configSections> <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/> <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/> <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/> <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/> </sectionGroup> </sectionGroup> </sectionGroup> </configSections> <system.web> <pages> <controls> <add tagPrefix="ajax" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add tagPrefix="ajax" namespace="Microsoft.Web.Preview.UI" assembly="Microsoft.Web.Preview"/> <add tagPrefix="ajax" namespace="Microsoft.Web.Preview.UI.Controls" assembly="Microsoft.Web.Preview"/> <add tagPrefix="ajax" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit"/> </controls> </pages> <!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development. -->
<compilation debug="true"> <assemblies> <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></assemblies> <buildProviders> <add extension="*.asbx" type="Microsoft.Web.Preview.Services.BridgeBuildProvider"/> </buildProviders> </compilation> <httpHandlers> <remove verb="*" path="*.asmx"/> <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/> <add verb="GET,HEAD,POST" path="*.asbx" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/> </httpHandlers> <httpModules> <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </httpModules> </system.web> <system.web.extensions> <scripting> <webServices> <!-- Uncomment this line to customize maxJsonLength and add a custom converter --> <!-- <jsonSerialization maxJsonLength="500"> <converters> <add name="DataSetConverter" type="Microsoft.Web.Preview.Script.Serialization.Converters.DataSetConverter, Microsoft.Web.Preview, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="DataRowConverter" type="Microsoft.Web.Preview.Script.Serialization.Converters.DataRowConverter, Microsoft.Web.Preview, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="DataTableConverter" type="Microsoft.Web.Preview.Script.Serialization.Converters.DataTableConverter, Microsoft.Web.Preview, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </converters> </jsonSerialization> --> <!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. --> <!-- <authenticationService enabled="true" requireSSL = "true|false"/> --> <!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and writeAccessProperties attributes. --> <!-- <profileService enabled="true" readAccessProperties="propertyname1,propertyname2" writeAccessProperties="propertyname1,propertyname2" /> -->
</webServices> <!-- <scriptResourceHandler enableCompression="true" enableCaching="true" /> -->
</scripting> </system.web.extensions> <system.webServer> <validation validateIntegratedModeConfiguration="false"/> <modules> <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </modules> <handlers> <remove name="WebServiceHandlerFactory-Integrated"/> <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="ASBXHandler" verb="GET,HEAD,POST" path="*.asbx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </handlers> </system.webServer> </configuration>
Chris Porter
Member
8 Points
6 Posts
Two components with the same id ‘{0}’ can’t be added to the application
Jan 23, 2007 11:11 PM|LINK
After updating to the 1/23 release of AJAX/CTP/AjaxToolKit I started receiving different versions of the following javascript error message:
> Two components with the same id ‘{0}’ can’t be added to the application
an example of the actual error message:
> Error: Sys.InvalidOperationException: Two components with the same id 'ctl00_cphMain_acNounPopupBehavior' can't be added to the application.
I would get this error message for every instance of an AutoCompleteExtender that existed in the UpdatePanel I was working in. The error would happen when called an OnClick event for a button that was also in that UpdatePanel. After the error messages occurred, the AutoCompleteExtenders would stop functioning. If I tried to use one of the AutoCompleteExtenders I would get the following javascript error:
> Error: 'this._popupBehavior' is null or not an object.
I searched up and down these forums for a solution and did see a few other users having similar problems with extenders + update panels and receiving the "two components" error message but I found no working solutions. I tried to recreate the error with a from scratch AJAXWebApplication and was unable to. I copied the working code form my from scratch app to my application with the error and it started experiencing the same error. I looked through the web.config file about 10 times before running it through WinMerge to compare and found the following difference:
> <compilation debug="false"> (on the working version)
> <compilation debug="true"> (on the non-working version)
I changed debug to false for my primary application and it fixed the "two component" error message. I don't know if this will fix the other errors that were similar to mine but I wanted to post this in hopes it might. Also, looking back over the migration docks I did find this:
> Move settings that determine whether to render the debug or the retail version of JavaScript code out of the page and into the Web.config file, as shown here:
> <configuration>
> <system.web>
> <compilation debug="false" />
> </system.web>
> </configuration>
I was previously running in true debug mode without issues so I never considered this to be an important command. Obviously something changed in the latest release that is affected by debug = true.
Hope this helps
web.config updatepanel AutoCompleteExtender Ajax Extensions
SimonCal
Participant
1910 Points
384 Posts
Microsoft
Re: Two components with the same id ‘{0}’ can’t be added to the application
Jan 24, 2007 12:19 AM|LINK
The debug or release versions of script are handled through the ScriptManager that makes a determination from the compilation section in (app root) config, the deploymentmode section in config (wins in all cases), and the local ScriptMode on the ScriptManager. It does not use the Page directive's debug setting.
When you use the debug scripts, then exception messages are possiblly thrown, but would not be the case in the 'release'; versions of the script. This is because the debug scripts are built for development scenarios, but the release is trimmed for performance reasons. Even though you see the exception error disappear in the debug=false case, the issue remains.
Essentially, the client-side type generated by the extender(s) are attempting to add more than one type with the same (unique) ID to the Sys.Application. This is the result of the ID specified on that type. Can you post your sample code first for us to look at to start delving deeper?
This posting is provided "AS IS" with no warranties, and confers no rights.
Roman Shumik...
Member
119 Points
25 Posts
Re: Two components with the same id ‘{0}’ can’t be added to the application
Jan 24, 2007 07:34 AM|LINK
today I installed AJAX.NET 1.0 RTM and now experiencing the same problem, probably a bug in AutoCompleteExtender.
I have AutoCompleteExtender inside UpdatePanel, which is inside one of my WizardSteps. When I switch WizardSteps and return to the step where AutoCompleteExtender is, I get this error.
Please help, many aspx pages in my project are now unusable.
ajax .net 1.0 rtm bugs
lc_
Member
17 Points
10 Posts
Re: Two components with the same id ‘{0}’ can’t be added to the application
Jan 24, 2007 11:01 AM|LINK
I have the same problem. At first I was happy the AutocompleteExtender in the Toolkit would stop the message with the "secure and non-secure items", which appeared using SSL previously.
Now I don't have this issue anymore, but the problem with the two ids. Actually it's annoying to falling from one problem to the other with every "release"...
My code and settings are as following:
-Using Master Pages
-Using AutocompleteExtender within ascx user control
-within user control is a scriptmanagerproxy
-the I have an UpdatePanel containing the textbox and extender
lc_
Member
17 Points
10 Posts
Re: Two components with the same id ‘{0}’ can’t be added to the application
Jan 24, 2007 11:29 AM|LINK
i forgot to mention...
Error is occuting here
function Sys$_Application$addComponent(component) { /// <param name="component" type="Sys.Component"></param> var e = Function._validateParams(arguments, [ {name: "component", type: Sys.Component} ]); if (e) throw e; var id = component.get_id(); if (!id) throw Error.invalidOperation(Sys.Res.cantAddWithoutId); if (typeof(this._components[id]) !== 'undefined') throw Error.invalidOperation(String.format(Sys.Res.appDuplicateComponent, id)); <<<<<< Exception this._components[id] = component; }psyafter
Member
108 Points
33 Posts
Re: Two components with the same id ‘{0}’ can’t be added to the application
Jan 24, 2007 01:37 PM|LINK
try my solution(bug in dispose)
http://forums.asp.net/thread/1546216.aspx
lc_
Member
17 Points
10 Posts
Re: Two components with the same id ‘{0}’ can’t be added to the application
Jan 24, 2007 03:04 PM|LINK
Thanks for the tip.
I'll try as soon as possible to recompile it...nevertheless.
Wouldn't ist be much easier to "bugfix" the toolkit itself. This seems to be a "little" correction and Toolkit doesn't seem to have such a strict release management as AJAX-Extensions...
Did anybody report the error to those guys as well?
kind regards,
Chris
Chris Porter
Member
8 Points
6 Posts
Re: Two components with the same id ‘{0}’ can’t be added to the application
Jan 24, 2007 04:11 PM|LINK
I am using the Ajax Ext, CTP and AjaxControlToolkit released 1/23/2007. I was able to fix the problem using the corrected code here: http://forums.asp.net/thread/1546666.aspx. Hopefully this source code will help you resolve the issue.
main.master
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="main.master.cs" Inherits="main" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:contentplaceholder id="ContentPlaceHolder1" runat="server"> </asp:contentplaceholder> </div> </form> </body> </html>default.aspx
Default.aspx.cs
ws1.asmx
<%@ WebService Language="C#" CodeBehind="~/App_Code/ws1.cs" Class="ws1" %>ws1.cs
web.config
lc_
Member
17 Points
10 Posts
Re: Two components with the same id ‘{0}’ can’t be added to the application
Jan 25, 2007 02:41 PM|LINK
Hi all,
thanks to psyafter - your other posts fixes the problem.
Nevertheless I think this is serious, especially regarding the fact that the autocompleteExtender moved to AjaxControlToolkit with 1.0 RTM.
I have to get myself an Codeplex Account an vote on the issue (as fast as possible).
Would be nice if you guys would do the same!!!!
http://www.codeplex.com/AtlasControlToolkit/WorkItem/View.aspx?WorkItemId=7585
sburke_msft
Contributor
4396 Points
770 Posts
Microsoft
Re: Two components with the same id ‘{0}’ can’t be added to the application
Jan 25, 2007 07:57 PM|LINK
Thanks guys for reporting the issue. I've got a dev looking at it now - your fix/debugging sounds right.