Solved

Page_Load in codebehind page is not working

Posted on 2009-07-01
8
640 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

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…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

705 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