An error has occurred because a control with id {0} could not be located or a different control is assigned to the same ID after postback

百般思念 提交于 2019-12-13 01:48:34

问题


I have a site that consists of an ajax driven menu, administration.aspx, and several linked pages in this menu.

Somtimes though, the navigation between them seems to be broken. For instance, when situated at LayoutSettings.cs, clicking Countries.cs just causes LayoutSettings.cs to reload (but Countries.cs can be reached from other pages on the site).

No error message gets displayed, but upon setting a breakpoint in Global.asax.cs.Application_Error(), I notice that the following is happening:

Application error: System.Web.HttpException (0x80004005): English translation: An error has occurred because a control with id ctl00$SiteContentPlaceHolder$ctl00$ctl01 could not be located or a different control is assigned to the same ID after postback. If the ID is not assigned, explicitly set the ID property of controls that raise postback events to avoid this error.

I can't see anything suspicious in the markup for either link in the administration.aspx files. I also don't see any controls in the LayoutSettings and Countries.cs files with duplicate names (or unassigned names). What can I try from now on? As best as I can tell, ViewState is enabled.

I would gladly share relevant code, but I'm not sure exactly what should be included just yet.

来源:https://stackoverflow.com/questions/20051995/an-error-has-occurred-because-a-control-with-id-0-could-not-be-located-or-a-di

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!