Event handler in usercontrol


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  1. En la página:
  2.  
  3. this.AddProductRate.SubmitClicked += new SiteControls_AddRate.SubmitClickedHandler(
  4. ShowRatesFromPage
  5. );
  6.  
  7. En addproductrate:
  8.  
  9. public delegate void SubmitClickedHandler();
  10.  
  11. public event SubmitClickedHandler SubmitClicked;
  12. protected virtual void OnSubmitClicked()
  13. {
  14. // If an event has no subscribers registerd, it will
  15. // evaluate to null. The test checks that the value is not
  16. // null, ensuring that there are subsribers before
  17. // calling the event itself.
  18. if (SubmitClicked != null)
  19. {
  20. SubmitClicked(); // Notify Subscribers
  21. }
  22. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.