1

当我通过 NuGet 将 AjaxControlToolkit.dll 升级到工具包的最新版本时,我的项目现在会产生一个错误,告诉我页面上有多个 ID 为 _header 的控件。我不确定在 _header 的 id 的客户端上实际生成了什么,但我想我会先询问 stackoverflow 社区,然后再回滚并从最后一个已知的工作版本的代码中检查出来。

这是错误的确切堆栈跟踪:

    EXCEPTION:Multiple controls with the same ID '_header' were found. FindControl requires that controls have unique IDs.
Data:System.Collections.ListDictionaryInternal
Stack Trace:   at System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls)
   at System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls)
   at System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls)
   at System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls)
   at System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls)
   at System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls)
   at System.Web.UI.Control.EnsureNamedControlsTable()
   at System.Web.UI.Control.FindControl(String id, Int32 pathOffset)
   at System.Web.UI.Control.FindControl(String id)
   at System.Web.UI.ControlUtil.FindTargetControl(String controlID, Control control, Boolean searchNamingContainers)
   at System.Web.UI.UpdatePanelControlTrigger.FindTargetControl(Boolean searchNamingContainers)
   at System.Web.UI.AsyncPostBackTrigger.Initialize()
   at System.Web.UI.UpdatePanelTriggerCollection.Initialize()
   at System.Web.UI.UpdatePanel.Initialize()
   at System.Web.UI.UpdatePanel.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
4

1 回答 1

2

所以这就是最终的答案:当将 ASP .NET Ajax 版本更新到最新版本时,现在需要为 Accordion Control 内的每个 Accordion Pane 拥有一个 ID。如果您不为它们分配 ID,它会为您生成一个“_header”。就我而言,我有不止 1 个 Accordion Pane,所以确实有不止 1 个具有相同的 ID。我希望这对其他人有帮助。是帮助我指出正确方向的帖子。大起大落 CurtWRC :)

于 2012-11-20T15:11:44.270 回答