473,756 Members | 2,900 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Page_Load not getting called?

I have a webapp which consists of several different webforms.
Basically:
(1) view the contents of a database
(2) one is to add a new entry
(3) confirms the new entry.

The third form, upon confirming the entry (in a button_clicked handler) adds
the entry into the database and then redirects back to (2) using
Response.Redire ct(..)

However, I've recently run into a problem - for some reason the Page_Load in
(2) is not getting called. At all. I noticed it first when I added the
redirect from (3). That redirects and adds a URL parameter
("event.aspx?ad ded=true"). In the Page_Load of (2), I added a conditional
that "if (Request.QueryS tring["added"] == "true")" then a hidden-by-default
label field gets its Visibility set to true (says "Successful ly added").
However, nothing happened - the page loaded as normal, without the new
label.
To test my sanity, I added Response.Redire ct("www.yahoo.c om", true) as the
very first line in Page_Load (not under any conditional - it should happen
everytime). Did a complete rebuild of the application, cleared IE cache,
and directed it to my page. Still loaded as normal - no redirect to yahoo.

Other events on the page (like the form submit button) work fine - it
correctly validates the data (or shows another hidden label if data was
invalid). Page_Load just seems like it is not triggering at all. Any ideas
on what might be happening?

Thanks!

Adam Clauss
ca*****@tamu.ed u

Nov 16 '05 #1
5 7342
Hi,

Check that you have this code:
protected override void OnInit(System.E ventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeCompo nent();
base.OnInit(e);
}

private void InitializeCompo nent()
{

this.Load += new System.EventHan dler(this.Page_ Load);
}

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Adam Clauss" <ca*****@tamu.e du> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
I have a webapp which consists of several different webforms.
Basically:
(1) view the contents of a database
(2) one is to add a new entry
(3) confirms the new entry.

The third form, upon confirming the entry (in a button_clicked handler) adds the entry into the database and then redirects back to (2) using
Response.Redire ct(..)

However, I've recently run into a problem - for some reason the Page_Load in (2) is not getting called. At all. I noticed it first when I added the
redirect from (3). That redirects and adds a URL parameter
("event.aspx?ad ded=true"). In the Page_Load of (2), I added a conditional
that "if (Request.QueryS tring["added"] == "true")" then a hidden-by-default label field gets its Visibility set to true (says "Successful ly added").
However, nothing happened - the page loaded as normal, without the new
label.
To test my sanity, I added Response.Redire ct("www.yahoo.c om", true) as the
very first line in Page_Load (not under any conditional - it should happen
everytime). Did a complete rebuild of the application, cleared IE cache,
and directed it to my page. Still loaded as normal - no redirect to yahoo.
Other events on the page (like the form submit button) work fine - it
correctly validates the data (or shows another hidden label if data was
invalid). Page_Load just seems like it is not triggering at all. Any ideas on what might be happening?

Thanks!

Adam Clauss
ca*****@tamu.ed u

Nov 16 '05 #2
Hi,

How is your Page_Load declared, does it match the EventHandler signature and
what accessible level does it have?

If AutoEventWireUp is set to true or missing in the <%@ Page %> directive
the accessible level of the auto-wired-up handlers should be public or
protected. If these are private or internal they will not be attached to the
event(s).

If AutoEventWireUp is false - check in the designer-generated code
(InitializeComp onent) if Page_Load is attached to the Load event. In this
case the accessible level doesn't matter.

Also, there are some reports for server caching of the aspx pages,
especially on IIS6 (Windows 2003). To rule out this add the following code
to your Application_Beg inRequest handler in the global.asax of the
application:

Response.Expire sAbsolute = DateTime.Now.Ad dDays(-1);
Response.Cache. SetCacheability (System.Web.Htt pCacheability.N oCache);
Response.Append Header("Pragma" , "no-cache");

compile, restart the www service and run the webapp.

Hope this helps
Martin Dechev
ASP.NET MVP
"Adam Clauss" <ca*****@tamu.e du> wrote in message
news:#u******** ******@TK2MSFTN GP09.phx.gbl...
I have a webapp which consists of several different webforms.
Basically:
(1) view the contents of a database
(2) one is to add a new entry
(3) confirms the new entry.

The third form, upon confirming the entry (in a button_clicked handler) adds the entry into the database and then redirects back to (2) using
Response.Redire ct(..)

However, I've recently run into a problem - for some reason the Page_Load in (2) is not getting called. At all. I noticed it first when I added the
redirect from (3). That redirects and adds a URL parameter
("event.aspx?ad ded=true"). In the Page_Load of (2), I added a conditional
that "if (Request.QueryS tring["added"] == "true")" then a hidden-by-default label field gets its Visibility set to true (says "Successful ly added").
However, nothing happened - the page loaded as normal, without the new
label.
To test my sanity, I added Response.Redire ct("www.yahoo.c om", true) as the
very first line in Page_Load (not under any conditional - it should happen
everytime). Did a complete rebuild of the application, cleared IE cache,
and directed it to my page. Still loaded as normal - no redirect to yahoo.
Other events on the page (like the form submit button) work fine - it
correctly validates the data (or shows another hidden label if data was
invalid). Page_Load just seems like it is not triggering at all. Any ideas on what might be happening?

Thanks!

Adam Clauss
ca*****@tamu.ed u

Nov 16 '05 #3
Adam,

Also check that your page directive correctly shows the Inherits attribute
for your code behind library, eg:
<%@ Page language="c#" Inherits="WebAp plication1.WebF orm1" %>

If your other events are firing OK this probably is already OK, but it may
be that the validation you are seeing is only happening on the client side.

Chris.
"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

Check that you have this code:
protected override void OnInit(System.E ventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeCompo nent();
base.OnInit(e);
}

private void InitializeCompo nent()
{

this.Load += new System.EventHan dler(this.Page_ Load);
}

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Adam Clauss" <ca*****@tamu.e du> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
I have a webapp which consists of several different webforms.
Basically:
(1) view the contents of a database
(2) one is to add a new entry
(3) confirms the new entry.

The third form, upon confirming the entry (in a button_clicked handler)

adds
the entry into the database and then redirects back to (2) using
Response.Redire ct(..)

However, I've recently run into a problem - for some reason the Page_Load

in
(2) is not getting called. At all. I noticed it first when I added the
redirect from (3). That redirects and adds a URL parameter
("event.aspx?ad ded=true"). In the Page_Load of (2), I added a conditional
that "if (Request.QueryS tring["added"] == "true")" then a

hidden-by-default
label field gets its Visibility set to true (says "Successful ly added").
However, nothing happened - the page loaded as normal, without the new
label.
To test my sanity, I added Response.Redire ct("www.yahoo.c om", true) as the
very first line in Page_Load (not under any conditional - it should happen
everytime). Did a complete rebuild of the application, cleared IE cache,
and directed it to my page. Still loaded as normal - no redirect to

yahoo.

Other events on the page (like the form submit button) work fine - it
correctly validates the data (or shows another hidden label if data was
invalid). Page_Load just seems like it is not triggering at all. Any

ideas
on what might be happening?

Thanks!

Adam Clauss
ca*****@tamu.ed u


Nov 16 '05 #4

Turn on your load on "every visit to the page" option in
IE, else don't rely on the page being relaaded when you
are just redirected to it.
-----Original Message-----
I have a webapp which consists of several different webforms.Basically:
(1) view the contents of a database
(2) one is to add a new entry
(3) confirms the new entry.

The third form, upon confirming the entry (in a button_clicked handler) addsthe entry into the database and then redirects back to (2) usingResponse.Redir ect(..)

However, I've recently run into a problem - for some reason the Page_Load in(2) is not getting called. At all. I noticed it first when I added theredirect from (3). That redirects and adds a URL parameter("event.aspx?a dded=true"). In the Page_Load of (2), I added a conditionalthat "if (Request.QueryS tring["added"] == "true")" then a hidden-by-defaultlabel field gets its Visibility set to true (says "Successful ly added").However, nothing happened - the page loaded as normal, without the newlabel.
To test my sanity, I added Response.Redire ct ("www.yahoo.com ", true) as thevery first line in Page_Load (not under any conditional - it should happeneverytime). Did a complete rebuild of the application, cleared IE cache,and directed it to my page. Still loaded as normal - no redirect to yahoo.
Other events on the page (like the form submit button) work fine - itcorrectly validates the data (or shows another hidden label if data wasinvalid). Page_Load just seems like it is not triggering at all. Any ideason what might be happening?

Thanks!

Adam Clauss
ca*****@tamu.e du

.

Nov 16 '05 #5
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > wrote in message news:ON******** ******@tk2msftn gp13.phx.gbl...
Hi,

Check that you have this code:
protected override void OnInit(System.E ventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeCompo nent();
base.OnInit(e);
}

private void InitializeCompo nent()
{

this.Load += new System.EventHan dler(this.Page_ Load);
}


Wierd... I hadn't thought to check inside that region (as I hadn't modified any of it - by hand anyway). But yeah, the adding of
the event handler was completely gone... everything else was fine, just that. Visual Studio scares me sometimes :)

Thanks for your help!
--
Adam Clauss
ca*****@tamu.ed u

Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2102
by: George Ter-Saakov | last post by:
I just find out in a debug that Page_Load is called 12 times when rendering the page. What could be the problem? All this page has is a bunch of UserConrols. I did check the InitalizeComponent. It hooked up only once there and AutoEventWireup="false"
2
1372
by: samir dsf | last post by:
hi I had been using this datagrid for long. all well...but suddenly the itemdatabound event is not at all getting called...i dont see my links..initally it worked well here is the page_load and itemdatabound event. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here
5
3164
by: Andy | last post by:
Hi all, I have a site with the following architecture: Common.Web.dll - Contains a CommonPageBase class which inherits System.Web.UI.Page myadd.dll - Contains PageBase which inherits CommonPageBase - Contains myPage which inherits PageBase Each of these classes overrides OnInit and ties an event handler
0
1756
by: Erik | last post by:
Why isn't my update method getting called? Pasted below is an aspx from a 1.1 application I'm working on. It has two textboxes and a button for inserting data into the database, and a datagrid for editing and deleting data. When a user clicks on the "Edit" button in the datagrid, Edit() method is called and the appropriate row is changed into textboxes. And if user clicks on the "Update" button, the Update() method is fired. But if...
1
1307
by: jm.suresh | last post by:
In the following code, I could not find out why the set and get methods are not called once I set the property. .... def __init__(self): .... self._color = 12 .... def _setcolor(self,value): .... print 'setting' .... self._color = value .... def _getcolor(self):
11
2701
by: fiefie.niles | last post by:
I am using ASP.NET 2005 and I have a simple form. Page_Load calls a sub mySub that does not do anything (for testing purposes). But, Page_Load gets called twice. On every single ASPX page in my site, Page_Load gets called twice. Why is that and how can I fix this problem ? Thank you very much. Imports System.IO Namespace myProject Partial Class WebForm1
1
3614
by: sean | last post by:
I'm trying to create "rubber-band" rectangles by overriding the OnPaint method to place rectangles on top of all graphic controls, but when I call Me.Invalidate() (when the user moves the mouse), OnPaint is not getting called... Here is the relevent code: I'm trying to create a "rubber band" rectangle effect on my form. Private Sub HighlightSectionOfTrack(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles...
3
1378
by: Abubakar | last post by:
Hi, I have a dll that gets called by an exe, I just placed a little code in its dlmain method and put a breakpoint on the code only to discover that its getting called nearly hundreds of times. I suspect each time some exported function is getting called the dllmain also gets called. Why is it happening and why should it happen? Regards, ...ab
4
3731
by: SAL | last post by:
Hello, I'm working, basically my first, AJAX page and am having a few problems. One is that the Click event for a button I have in UpdatePanel1 is not getting called. I've tried with the button both inside and outside of the updatepanel and the event doesn't get called either way. What might I be missing here? Incidently, something else, kind of weird, is happening when the button is clicked, a required field validator control in a...
0
9275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10034
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9872
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9843
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9713
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3358
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.