如何更新在另一个的UpdatePanel控件?控件、UpdatePanel

2023-09-10 19:56:11 作者:沉醉花海

我在层级3的UpdatePanel:

I have three updatepanels in hierarchy:

UpdatePanel1--Root
  UpdatePanelChild1
  UpdatePanelChild2

我可以更新updatePanel1控制在updatepanel2的事件?

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

推荐答案

我并不是每一个更新的UpdatePanel所有的时间的忠实粉丝 - 这似乎是撤销地方更新面板让你

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

另一种方法是专门打电话通知其他更新面板的.Update()方法,在你的code。例如,假设你有UppdatePanelChild1一个按钮,做一些处理并修改UpdatePanel2控制:

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();