开发者

I am getting Could not find UpdatePanel with ID Exception while using UpdatePanel

On an asp开发者_如何学编程x page i am having a dropdownlist and a panel control the dropdownlist autopostback is true. in dropdownlist control there are two options and depending on the option selected by the user i display a user control containing ajax updatepanel with a timer configured to launch async request after every one second. the problem arises when user selects the other option in dropdownlist control and the user control gets changed in the panel control. The error which is occured is shown below:

Sys.InvalidOperationException: Could not find UpdatePanel with ID 'ctl00_ctl00_cphMainMasterPage_ChildContent_ctrlPinStatusMonitor_updpnlPinStatus'. If it is being updated dynamically then it must be inside another UpdatePanel.

I thnk the problem is that the last control which have launched the async request is no more available in the panel control and gets replaced by the new other user control. Can anyone suggest a solution to get rid of this error.


Have your Timer check the DOM for the existence of the correct control before executing.


I have resolved the problem by placing the same logic in the Page Load event handler, which i am using to load the user control when user selects a different option from the dropdownlist control i.e. the logic presenet in the dropdownlist selectedindexchanged event handler. In this way the update panel which have launched async request last time is still available after postback generated by dropdownlist's autopostback option.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜