首页 > 编程语言 >ASP.NET Ajax exception - Two components with the same id can't be added to the application

ASP.NET Ajax exception - Two components with the same id can't be added to the application

时间:2023-11-09 12:36:45浏览次数:32  
标签:www exception ASP Two Sys added components com id

There's a couple of exceptions to look out for when you start developing custom ASP.NET Ajax client controls.  They are:

Microsoft JScript runtime error: Sys.InvalidOperationException: Two components with the same id 'ctl00_MainContentPlaceHolder__eventsRepeater_ctl01_ke1' can't be added to the application.

and...

Microsoft JScript runtime error: Sys.InvalidOperationException: A control is already associated with the element.

ASP.NET Ajax exception - Two components with the same id can

These errors can be caused when you have a custom control/component which gets added and then re-added at some later point in time - such as when you have a partial page render.  This is being caused because the Sys.Control or Sys.Component gets registered with the Sys.Application when you call the initialize method of your component like so:

MarkItUp.Web.MyCustomControl.callBaseMethod(this, 'initialize') ;

Under the hood, the Sys.Application keeps a list of all the components that are registered with it - that's how $find works.  So when you call 'initialize', Sys.Application looks at the list of components that it currently knows about and if yours already exists then you will likely see one of the errors listed above.

The trick is to make sure that you call dispose on your control's base when you are finished:

dispose : function() {
    $clearHandlers(this.get_element()) ;
    // any other cleanup work

MarkItUp.Web.MyCustomControl.callBaseMethod(this, 'dispose') ;
}

http://showusyourcode.spaces.live.com/Blog/cns!15630F96CB7D86C1!582.entry

http://forums.asp.net/p/1066748/1548516.aspx

http://www.velocityreviews.com/forums/t518005-two-components-with-the-same-id-cant-be-added-to-the-application.html

http://www.experts-exchange.com/Programming/Languages/Scripting/AJAX/Q_23735231.html

http://www.eggheadcafe.com/software/aspnet/30226324/two-components-with-the-s.aspx

http://bytes.com/groups/net-asp/669319-two-components-same-id-cant-added-application

http://www.codeplex.com/AjaxControlToolkit/WorkItem/View.aspx?WorkItemId=8904

http://www.telerik.com/community/forums/aspnet/ajax/sys-invalidoperationexception-two-components.aspx

http://www.nikhilk.net/Entry.aspx?id=152

http://forums.asp.net/p/1342154/2719761.aspx#2719761

http://stackoverflow.com/questions/397051/ajax-toolkit-reorderlist-two-components-with-the-same-id-componentid-cant-be-a

http://66.129.67.4/t/1094818.aspx

http://www.tech-archive.net/Archive/DotNet/microsoft.public.dotnet.framework.aspnet/2007-06/msg03056.html

http://dariosantarelli.wordpress.com/2007/06/13/ajaxcontroltoolkit-v1010606-strange-behaviour-of-the-modalpopupextender-control-with-dropshadow/

http://www.codeplex.com/AjaxControlToolkit/WorkItem/View.aspx?WorkItemId=10945

Calendar Extender generates message "Sys.InvalidOperationException: Two components with the same id '{ExtenderId}' can't be added to the application error." when the container update panel is refreshed

http://forums.asp.net/t/1127745.aspx 

Sys.InvalidOperationException: Two components with the same id 'bsdate' can't be added to the application

http://forums.asp.net/p/1342703/2721397.aspx



标签:www,exception,ASP,Two,Sys,added,components,com,id
From: https://blog.51cto.com/emanlee/8275930

相关文章

  • .net 温故知新【13】:Asp.Net Core WebAPI 使用依赖注入DI
    一、使用DI注入在之前的文章中已经讲过DI的概念(.net温故知新:【7】IOC控制反转,DI依赖注入),基于控制台程序演示了DI依赖注入的使用,基于Microsoft.Extensions.DependencyInjection完成。那在WebAPI中如何使用依赖注入呢?首先新建一个WebAPI项目WebAPI_DI,框架.net7,其实webapi项目......
  • 【ASP.NET】医院检验科实验室信息管理系统源码
    LIS是全院信息化建设的一个重要组成部分,其主要功能是将检验的实验仪器传出的检验数据经分析后,生成检验报告,通过网络存储在数据库中,使医生能够方便、及时的看到患者的检验结果,LIS已经成为现代化医院管理中必不可少的一部分。有助于提高实验室的整体管理水平,减少漏洞,提高检验质量。......
  • 界面组件DevExpress ASP.NET Core v23.1 - 进一步升级UI组件
    DevExpressASP.NETCore Controls使用强大的混合方法,结合现代企业Web开发工具所期望的所有功能。该套件通过ASP.NETRazor标记和服务器端ASP.NETCoreWebAPI的生产力和简便性,提供客户端JavaScript的性能和灵活性。ThemeBuilder工具和集成的MaterialDesign、通用主题集可以让......
  • PowerShell 函数遇见 Newtonsoft.Json.JsonReaderException: The reader's MaxDepth o
    问题描述创建PowerShellAzureDurableFunction,执行大量的PowerShell脚本操作AzureResource,遇见了一个非常非常奇怪的问题:Function'Hello1(Activity)'failedwithanerror.Reason:Newtonsoft.Json.JsonReaderException:Thereader'sMaxDepthof64hasbeenexceeded.Pa......
  • [论文阅读] [SAGAN] Self-Attention Generative Adversarial Networks
    Self-AttentionGenerativeAdversarialNetworks(mlr.press)ZhangH,GoodfellowI,MetaxasD,etal.Self-attentiongenerativeadversarialnetworks[C]//Internationalconferenceonmachinelearning.PMLR,2019:7354-7363.引用:4501原作者代码:brain-research/self-......
  • 【Azure Durable Function】PowerShell Activity 函数遇见 Newtonsoft.Json.JsonReade
    问题描述创建PowerShellAzureDurableFunction,执行大量的PowerShell脚本操作AzureResource,遇见了一个非常非常奇怪的问题:Function'Hello1(Activity)'failedwithanerror.Reason:Newtonsoft.Json.JsonReaderException:Thereader'sMaxDepthof64hasbeenexceeded.......
  • DataGrip连接MySql数据库失败:dataGrip java.net.ConnectException: Connection refuse
    1.问题报错:dataGripjava.net.ConnectException:Connectionrefused:connect.详细错误:[08S01]CommunicationslinkfailureThelastpacketsentsuccessfullytotheserverwas0millisecondsago.Thedriverhasnotreceivedanypacketsfromtheserver.Communica......
  • Aspose.Words解除word转pdf的页数限制
    参考文章Aspose.Words破解版用法示例Aspose.Words中文文档本篇文章可以实现解除word转pdf的页数限制,并去除水印。引入dll根据Aspose.Words破解版用法示例这篇文章中提供的dll以及证书,进行注册。右键项目添加项目引用,点击浏览选择15.7的dll进行添加在程序启动时注册......
  • Exception.printStackTrace()转换为String输出
    packagecom.test1;importjava.io.PrintWriter;importjava.io.StringWriter;publicclassT010{/***@paramargs*/publicstaticvoidmain(String[]args){try{String[]arr={"111&qu......
  • geonetwork源码编译与开发入门说明
    本文介绍geonetwork源码编译及简单的开发修改。本文包括源码调试的细节,主要给没怎么接触过java又想调试修改部分java代码的提供一定帮助,比如控制器或修改业务逻辑中的增删改操作等本文使用环境:操作系统:Windows11JDK版本:jdk-8u381-windows-x64.exeMaven版本:apache-maven-3.9.......