Hi,
Is it possible to set, on a control (a linkbutton for example) an eventhandler which is not in the same context as the control creation?
For example, I have an instance of Class1 which instances Class2, the control is created in Class2, but I need the eventhandler to be in Class1.
Pseudo Code:
public class Class1
{
public Class1()
{
Class2 MyClass2 = new Class2();
MyClass2.DoSomething();
}
public void EventHandler()
{
// Handle the event
}
}
public class Class2
{
public void DoSomething()
{
SomeControl control = new SomeControl();
control.SomeEvent += parent.EventHandler;
}
}
Regards Moo