Why is there a difference in nomenclature?

Why is this on .aspx pages preceded by " On", for example. " OnClick", " OnCommand", and in the file with the code designation they are transmitted " Click", " Command"? Just Naming Convention or is there some logical explanation?

+5
source share
3 answers

The names of the events themselves: Click, Change, etc. Internal methods for triggering these events from code are prefixed with "On" as a naming convention. In ASP.NET markup, you use the OnClick attribute, but what you are really doing is attaching the method to the "Click" event. So the method auto-generated for you by VS is ButtonName_Click. This method is internally passed as a delegate to the event itself.

+3
source

AFAIK, just a naming convention. They should have started with something :-) Before ASP.NET, I think this was also the case in Windows applications and in JavaScript.

http://www.c-sharpcorner.com/UploadFile/puranindia/165/

http://webdevelopersjournal.com/articles/jsevents1/jsevents1.html

+1
source

, , , , EVENT PROPERTY

"Click"... .

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

But in real control there is a property called "OnClick", through which it triggers the "Click" event. Therefore, they cannot be called one and the same.

0
source

All Articles