Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. override OnLoad or handle Load event

override OnLoad or handle Load event

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netvisual-studiowinformshelp
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    krisp
    wrote on last edited by
    #1

    Hi all, Curious why by default Visual Studio makes you handle the Load event, when you derive a class. Usually in a derived class I would think you would: protected override void OnLoad( EventArgs e ) { // my code base.OnLoad(e); // this will raise the Load event. // my code, is this the better spot, let the base do its load first? } but it seems that Visual Studio always adds an event handler to the Load event in your class for you to implement your own OnLoad code, why? OnInit(){ Load += new EventHandler( Page_Load ); } With windows forms, the documentation says that overriding OnFoo is the preferred way for inheritors. So why not for asp.net web controls, why the event handler instead? Is there much difference? Thanks for your opinions/help.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups