Solved

Page_Load in codebehind page is not working

Posted on 2009-07-01
8
635 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
  • 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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now