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. simple,short question

simple,short question

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netquestion
4 Posts 4 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.
  • A Offline
    A Offline
    Amr M K
    wrote on last edited by
    #1

    Iam very good in OOP but ... why Event of controls in asp.net defined as protected

    aj123

    K B C 3 Replies Last reply
    0
    • A Amr M K

      Iam very good in OOP but ... why Event of controls in asp.net defined as protected

      aj123

      K Offline
      K Offline
      kubben
      wrote on last edited by
      #2

      I would guess it is because they didn't want anyone overriding them. Ben

      1 Reply Last reply
      0
      • A Amr M K

        Iam very good in OOP but ... why Event of controls in asp.net defined as protected

        aj123

        B Offline
        B Offline
        badgrs
        wrote on last edited by
        #3

        I'm pretty sure they don't necessarily have to be, thats just the way VS adds them in, no reason they couldn't be public (they can't be private as the page that ends up as a subclass of your code-behind has to access them).

        1 Reply Last reply
        0
        • A Amr M K

          Iam very good in OOP but ... why Event of controls in asp.net defined as protected

          aj123

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          A page class instance exists only for a single postback. As it has no persistence, nothing external is ever going to access the event, unless it's in a control, but the fact is, it cannot be private ( as the aspx is turned into a class DERIVED from the code behind ), and it shouldn't be public ( no external class should be calling an event handler )

          Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

          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