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. Why doesn't PageLoad(..) get called?

Why doesn't PageLoad(..) get called?

Scheduled Pinned Locked Moved ASP.NET
csharpvisual-studiohelpquestion
4 Posts 3 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.
  • C Offline
    C Offline
    c121hains
    wrote on last edited by
    #1

    I'm running this project in Visual Studio .NET 2003 and when I click on this one page within my website, the PageLoad method in my code behind (myPage.aspx.vb) doesn't get called. Another method in the class DOES get called however. I set a break point in PageLoad but it is never reached. Also PageLoad sets a few global members but are not affected when the other method is called. Is this a bug in VS? Or some setting i'm missing?

    T M 2 Replies Last reply
    0
    • C c121hains

      I'm running this project in Visual Studio .NET 2003 and when I click on this one page within my website, the PageLoad method in my code behind (myPage.aspx.vb) doesn't get called. Another method in the class DOES get called however. I set a break point in PageLoad but it is never reached. Also PageLoad sets a few global members but are not affected when the other method is called. Is this a bug in VS? Or some setting i'm missing?

      T Offline
      T Offline
      turbochimp
      wrote on last edited by
      #2

      Check your InitializeComponent method. Is there a line hooking the Load event? It will look like: this.Load += new System.EventHandler(this.Page_Load); If not, you will need to add one. There is one added by default, but I have seen cases where Studio removes it when controls are moved or renamed. It's been extremely rare in my experience (like once or twice), but I have seen it happen to others as well.

      The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

      1 Reply Last reply
      0
      • C c121hains

        I'm running this project in Visual Studio .NET 2003 and when I click on this one page within my website, the PageLoad method in my code behind (myPage.aspx.vb) doesn't get called. Another method in the class DOES get called however. I set a break point in PageLoad but it is never reached. Also PageLoad sets a few global members but are not affected when the other method is called. Is this a bug in VS? Or some setting i'm missing?

        M Offline
        M Offline
        MoustafaS
        wrote on last edited by
        #3

        Or try the AutoEventWireup=true .

        C 1 Reply Last reply
        0
        • M MoustafaS

          Or try the AutoEventWireup=true .

          C Offline
          C Offline
          c121hains
          wrote on last edited by
          #4

          Thanks for your replies!! I managed to get it working on my own. However the two suggestions to the problem wouldn't work. The first one this.Load += new System.EventHandler(this.Page_Load); I think only applies to C#. I'm trying to get a forums VB project to run. I believe that the InitializeComponent method is usually hidden in VB projects in VS .NET so that's why i couldn't get it to work. The AutoEventWireup=true (instead of the default being = false) is only a performance switch. I think it allows you to manually trigger events instead of automatically triggering them. To fix my problem, I noticed that my Page_Load method was defined as Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) instead of Public Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ..that worked. Thanks for your responses though!!

          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