C# control events - Events in c# - c# - c# tutorial - c# net



C# Tutorial

  • 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,
  • learn c# - c# tutorial - c# events - c# control events - c# examples -  c# programs

learn c# - c# tutorial - c# events - c# control events - c# examples - c# programs

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 :

  • The access specifier defines the scope of the subroutine.
    • public is a global subroutine that can be used anywhere.
    • Private is available in a specific class.
    • Most subroutines will be public.
  • learn c# - c# tutorial - c# events - c# control events - c# examples -  c# programs
  • Designates the data type of the value to be returned from the subroutine.
    • void says the block of code does not return a value
    • Other data types could be returned
  • learn c# - c# tutorial - c# return types - c# examples -  c# programs
  • Names the subroutine or event handler
  • learn c# - c# tutorial - c# event handler - c# examples -  c# programs
  • Parameters allow information to be passed into the subroutine so it can be used or modified.
    • 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
  • learn c# - c# tutorial - c# event handler - c# examples -  c# programs

    Page Events in c# :

  • Every ASP.Net page has a page object with events associated with it
  • learn c# - c# tutorial - c# page events - c# examples -  c# programs

    learn c# - c# tutorial - c# events - c# Page Init - Page Load - Page PreRender - Page UnLoad - c# examples - c# programs



    Related Searches to C# Events