I feel like this is something that Google should be able to solve for me just fine, but I’m finding little to no examples that I really understand.
I have this custom control called UserControlTask. I wish to add an OnHide event to it and as the name implies, I want it to be thrown when the user control is being hidden.
I seem to find lot’s of examples of overriding events like OnClick, but none where a totally new event is being added.
All I really know is that I need to declare the EventHandler…
public event EventHandler Hide;
Then I believe add the OnHide to the attributes in my CreateChildControls method. I think that is accurate anyway. Beyond this I know nothing.
Your problem isn’t adding the event (which is easy:
Your problem is knowing when to call
OnHide()(which raises the event) – since there is no way to know when the user hides the control (I assume you are talking about something that happens in the client side), there is no time in which you should raise this event.