How do I trigger an event for a control that is present inside a custom control?
2 answers
Take a look at this post:
How do I access a button that is inside a custom control from the implementation page?
0
a source to share
You have 2 ways:
You can access the button click event through a user control object. For instance,
MyUC.button1.click += //etc
You can create your custom event for this specific button by clicking in the user control. For example, in your usercontrol, you have:
public delegate void OnButtonClick(object sender, EventArgs e);
public event OnButtonClick Button1Click;
button1_click(object sender, EventArgs e)
{
if(Button1Click != null)
Button1Click(this, e);
}
Then you track this event in your custom control:
MyUC.Button1Click += //etc.
0
a source to share