C# control events - Events in c# - c# - c# tutorial - c# net
- Most ASP.Net pages will contain controls such as textboxes and buttons that will allow the user to interact with them.
- When some action is performed, the control will raise an event (call handler code)
- When an event is raised, handler code is called,
c# Button Control Events… :
- OnClick – when user clicks a button
- OnCommand – When user clicks button
- OnLoad – When page first loads and button loads
- OnInit – When button is initialized
- OnPreReader- just before button is drawn
- OnUnload – When button is unloaded from memory
- OnDisposed – When button is released from memory
- OnDataBinding – When button is bound to a data source
Components of a Subroutine :
- public is a global subroutine that can be used anywhere.
- Private is available in a specific class.
- Most subroutines will be public.
- void says the block of code does not return a value
- Other data types could be returned
- Object's is the object to which this event belongs
- Object is the base class for every class in C#
- EventArgs e allows an array of information to be passes as one parameter
Page Events in c# :
c# page events