Saturday 15 August 2015

c# - Adding and removing events in ASP.NET -


I recently discovered this technique in my ASP.Net code base, which I maintain. What does it do and how do I use it? And perhaps more importantly is whether ASP.NET Are All Simulated Pages Using Life-Cycle-Events?

  Cancel Public Event EventHeader Event {addButton.Click + = value; } Remove {cancelButton.Click - = Value; }}  

Rushkar says that the use of this program is now unused and I've never seen this technique before. Usually I wire my events on OnInit.

  cancelButton.Click + = HandleClick;  

This is only assigning event handling - when someone clicks your CancelEvent Event, just adding that event handler to the cancelButton click on event and so on.

This means that your type is just highlighting a program representing the cancellation rather than highlighting the button. Of course, if anything does not want to use that incident, then in this case It's useless - but it's an interesting technique to know.


No comments:

Post a Comment