UserControl 内的一页上有多个 ModalPopUpExtender
我在 UserControl 中有 1 个 ModalPopupExtender 。一切都运行良好,直到我开始向页面添加相同的用户控件。我在 javascript 控制台中收到此错误消息::
消息:Sys.InvalidOperationException:无法将具有相同 ID“MPE1”的两个组件添加到应用程序。
我理解该错误,很明显框架需要唯一的 ID。我不知道如何给它们起一个独特的名字。预先感谢您的任何帮助。
I have 1 ModalPopupExtender inside a UserControl. Everything works great until I start adding the same usercontrol to the page. I am getting this error message in the javascript console::
Message: Sys.InvalidOperationException: Two components with the same id 'MPE1' can't be added to the application.
I understand the error, it obvious that the framework wants unique IDs. What I can't figure out is how to give them unique name. Thanks in advance for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Brian,谢谢,但这是在 .NET 2.0 中。
解决此问题的简单方法是删除标签“BehaviorID”。这就是我现在要使用的选项,我只是希望将来我不必使用 JS 来调用任何弹出窗口。
Brian, thanks but this is in .NET 2.0.
The simple way to solve this is to just remove the tag "BehaviorID". That is the option I am going with now, I just hope in the future I won't have to use JS to call any of the popups.
您是否使用 ClientIDMode 为静态的 .NET 4?这会导致问题,尽管使用默认或预测选项,这应该可以工作...检查客户端占用空间,查看是否所有 ID 都是 MPE1 或如何完成。它应该是 uc1_MPE1。如果您有两个具有相同 ID(或空 ID)的 UC,则会导致问题。
HTH。
Are you using .NET 4 with a ClientIDMode of static? That would cause the issue, though with the default or a predictive option, this should work... check the client footprint, to see if all of the ID's are MPE1 or how that's being done. It should be uc1_MPE1. If you have two UC's with the same ID (or null ID), that would cause the issue.
HTH.
有两种方法可以解决此问题:
There are two ways to solve this: