从一个用户控件到另一个用户控件的fire load事件 [英] fire load event from one user control to another usercontrol

查看:84
本文介绍了从一个用户控件到另一个用户控件的fire load事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,

假设我们有两个用户控制UC1,UC2。我需要从UC1.ButtonClick调用UC2.BindDropDown()函数。



当我这样做时,我收到错误以找到下拉列表以便像对象引用未设置为强烈的对象错误。



所以我决定从UC1.ButtonClick调用UC2.PageLoad事件,以便每个控件都将初始化并绑定相关数据。



请帮我解决问题。提前谢谢!

Dear All,
Suppose we have two user control UC1, UC2. I need to call the UC2.BindDropDown() function from UC1.ButtonClick.

When I am doing it, I am getting error to find the dropdown so that error like "Object reference not set to intense of an object error".

So I decided to call the UC2.PageLoad event from UC1.ButtonClick so that every control will be initialize and bind the relevant data.

Please help me out the solution. Thank in advance!

推荐答案

不要。

假设两个控件是独立的(即一个不包含另一个)然后你应该指向包含两者的控件的点击,然后告诉第二个控件做什么。



看看这个:在两种表格之间转移信息,第3部分:孩子对孩子 [ ^ ] - 它描述了表格的流程,但控件完全相同(实际上,Form是控件的实例)
Don't.
Assuming that the two controls are independent (i.e. one doesn't contain the other) then you should indicate the click to the control containing both, and it then tells the second control what to do.

Have a look at this: Transferring information between two forms, Part 3: Child to Child[^] - it describes the process for Forms, but Controls are exactly the same (indeed, a Form is an instance of a Control)


这篇关于从一个用户控件到另一个用户控件的fire load事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆