how to update a control in another updatepanel?

▼魔方 西西 提交于 2019-12-04 04:14:26

问题


I have three updatepanels in hierarchy:

UpdatePanel1--Root
  UpdatePanelChild1
  UpdatePanelChild2

Can I update a control in updatePanel1 on an event of the updatepanel2?


回答1:


I'm not a big fan of every updatepanel updating all the time - that seems to undo the locality update panels get you.

Another option is to specifically call the .Update() method of the OTHER update panel in your code. For example, suppose you have a button on UppdatePanelChild1 that does some processing and modifies a control in UpdatePanel2:

textBoxInsideUpdatePanel2.Text = "Updated!";
UpdatePanel2.Update();



回答2:


Yes, the easiest way is have UpdateMode="Always"; then all update panels update regardless of whichever one triggered the postback.



来源:https://stackoverflow.com/questions/13701338/how-to-update-a-control-in-another-updatepanel

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