简体   繁体   English

从usercontrol1更新按钮更新usercontrol2中的数据

[英]Updating data in usercontrol2 from usercontrol1 update button

I've have a userControl that houses other userControls within tab items. 我有一个userControl,可在选项卡项中容纳其他userControl。 They are made visible and cleared by interaction with various checkbox's on my parent userControl (all working). 通过与我的父userControl上的各个复选框进行交互,可以使它们可见并清除(均正常工作)。 I've validation and writetodatabase functions in place which works for parent userControl. 我已经到位的验证和writetodatabase函数适用于父userControl。 What I need to have happen is when "Update" (utilizes CommandBinding) button on uC1 is clicked, that all relevant child uC data on other tabs are saved to db as well. 我需要做的是,当单击uC1上的“更新”(利用CommandBinding)按钮时,其他选项卡上的所有相关子uC数据也都保存到了db。 I've got validation to work but am stumped in saving the data of uC2/uC3/uC4 etc. ... any pointers would be most welcome. 我已经进行了验证,但是在保存uC2 / uC3 / uC4等数据时陷入了困境。...任何指针都将受到欢迎。 PS I'm trying to keep my uC's as loosely coupled as possible... I'm a beginner so please be gentle (step by step's would be appreciated) PS:我正在努力使uC尽可能松散地耦合在一起……我是一个初学者,所以请保持柔和(一步一步地感谢您)

Thanks in advance. 提前致谢。

You could put a Save event on each child control, and have the parent page/control subscribe to those events. 您可以在每个子控件上放置一个Save事件,并让父页面/控件订阅这些事件。 Then it can ask the child controls to save themselves. 然后它可以要求孩子控件进行自我保存。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM