?
Solved

Page_Load in codebehind page is not working

Posted on 2009-07-01
8
Medium Priority
?
641 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 520 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 480 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

777 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