Solved

Page_Load in codebehind page is not working

Posted on 2009-07-01
8
639 Views
Last Modified: 2012-05-07
In an attempt to narrow down an original problem with masterfiles, I've gone back to a really simple set of test files.  Even at their very simplest, I'm not getting any activity from a Page_Load sub.

I have:
Test.aspx (a line of text, an asp:label, and then another line of text) and
Test.aspx.vb (with a Page_Load line to assign text to the asp:label)
(Both attached)

I don't understand why but the Page_Load is not doing anything.
If I move the Page Load sub onto a page without a codebehind page, it works fine.
Is my codebehind file declared properly?

Test.aspx.txt
Test.aspx.vb.txt
0
Comment
Question by:Beamson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
8 Comments
 
LVL 22

Accepted Solution

by:
prairiedog earned 130 total points
ID: 24754823
Change your Page_Load signature to this:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  'Your code
End Sub
0
 

Assisted Solution

by:JaCrews
JaCrews earned 120 total points
ID: 24754848
It appears your page Load sub is incorrectly formatted:
Should be:



    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub


0
 
LVL 1

Author Comment

by:Beamson
ID: 24754852
Solved!

I tried the textbook "Protected void Page_Load(object..." declaration and this works fine.
As I've mostly worked in older versions of the framework, a simple "Page_Load" has always done the job in the past.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Expert Comment

by:prairiedog
ID: 24754920
What is wrong with my comment?
0
 

Expert Comment

by:JaCrews
ID: 24755144
Really recommend using: http://www.microsoft.com/express/vwd/ 
the free visual web developer from microsoft.  then you will not run into these kinds of little issues - it builds the front page and code behind for you, so you can spend your time focusing on the bigger issues....like coding :)
0
 
LVL 1

Author Comment

by:Beamson
ID: 24755716
prariedog - don't know how that happened.  When I awarded the points to JaCrews, I am sure it was the only response showing.
0
 
LVL 1

Author Closing Comment

by:Beamson
ID: 31598787
I spotted this within seconds of my post but am so chuffed that its resolved, I'm more than happy to award the points.  I've spent HOURS not spotting this and getting nowhere.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question