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. Page methods subscribing to Control Events such as Load and PreRender

Page methods subscribing to Control Events such as Load and PreRender

Scheduled Pinned Locked Moved ASP.NET
questiontutorial
2 Posts 2 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.
  • S Offline
    S Offline
    swjam
    wrote on last edited by
    #1

    It makes sense that in the Page class, there are certain methods where the Page subscribes to the above Control class' events, for example:

    this.PreRender += new EventHandler(Page_PreRender);

    This is because, without the programmer writing this, you declare a method in Page class as follows:

        protected void Page\_Load(object sender, EventArgs e) {...}
        protected void Page\_PreRender(object sender, EventArgs e) {...} 
    

    and it automatically is invoked during the Load and PreRender events respectively. How do I determine which methods in Page class the subscription to the events are made? I don't think there is necessarily just 1 method where all the events are subscribed to. The reason I am asking is so that if I needed to subscribe to any of these events in my Page derived custom pages, I can place them properly.

    ---------------------------------------------------------- Lorem ipsum dolor sit amet.

    S 1 Reply Last reply
    0
    • S swjam

      It makes sense that in the Page class, there are certain methods where the Page subscribes to the above Control class' events, for example:

      this.PreRender += new EventHandler(Page_PreRender);

      This is because, without the programmer writing this, you declare a method in Page class as follows:

          protected void Page\_Load(object sender, EventArgs e) {...}
          protected void Page\_PreRender(object sender, EventArgs e) {...} 
      

      and it automatically is invoked during the Load and PreRender events respectively. How do I determine which methods in Page class the subscription to the events are made? I don't think there is necessarily just 1 method where all the events are subscribed to. The reason I am asking is so that if I needed to subscribe to any of these events in my Page derived custom pages, I can place them properly.

      ---------------------------------------------------------- Lorem ipsum dolor sit amet.

      S Offline
      S Offline
      senguptaamlan
      wrote on last edited by
      #2

      Try to dig down the AutoEventWireup attribute of the page directive and its use....you will be able to understand how the default events gets wired up with the event handler.

      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