Say I have a User Control in ASP.NET that contains a button:
public class MyUserControl : UserControl {
private Button btnSave = new Button();
}
I can expose any property of the button to the outside by making a property that points at the button:
public string SaveButtonText {
get { return btnSave.Text; }
set { btnSave.Text = value; }
}
So then I can do this to set the button's text:
MyControl.SaveButtonText = "hello world";
Is there a similar construct I can use to expose the button's events to the outside as well? Something like:
public event SaveButtonClick { return btnSave.OnClick; }
...
MyControl.SaveButtonClick += new EventHandler(...);