Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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!
Posted
Comments
Kornfeld Eliyahu Peter 2-Jul-14 7:04am    
Can you show your code...

1 solution

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)
 
Share this answer
 
Comments
Bhanu Pratap Verma 2-Jul-14 7:16am    
Dear, I am creating web application and both user control are Independent.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900