I have a user control with a button named upload in it. The button click event looks like this:
protected void btnUpload_Click(object sender, EventArgs e)
{
// Upload the files to the server
}
On the page where the user control is present, after the user clicks on the upload button I want to perform some operation right after the button click event code is executed in the user control. How do I tap into the click event after it has completed its work?
You have to create an event in your user control, something like:
public event EventHandler ButtonClicked;
and then in your method fire the event...
protected void btnUpload_Click(object sender, EventArgs e)
{
// Upload the files to the server
if(ButtonClicked!=null)
ButtonClicked(this,e);
}
Then you will be able to attach to the ButtonClicked event of your user control.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With