473,480 Members | 2,487 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Page_Load event gets called twice

I currently have an aspx page that contains a datagrid object and every time
the page goes through its lifecycle the Page_Load event gets called twice.
I've checked my code and I'm not manually calling it anywhere so the server
must be doing it. Can anybody tell me why? and is it possible to stop it?
Im using if(!IsPostBack) to see it its a reload and both calls are made
before the IsPostBack is set to true. Any help would be appreciated.

Thanks,
Dave
Nov 19 '05 #1
2 1274
I am guessing you are manually attaching the event handler and you have
AutoEventWireup set to True. You need one or the other.

"Dave Hagerich" <dh*******@arclighte.com> wrote in message
news:e1*************@TK2MSFTNGP09.phx.gbl...
I currently have an aspx page that contains a datagrid object and every
time
the page goes through its lifecycle the Page_Load event gets called twice.
I've checked my code and I'm not manually calling it anywhere so the
server
must be doing it. Can anybody tell me why? and is it possible to stop it?
Im using if(!IsPostBack) to see it its a reload and both calls are made
before the IsPostBack is set to true. Any help would be appreciated.

Thanks,
Dave

Nov 19 '05 #2
Yup that was the problem. I forgot I turned that on.

Thank you
Dave

"Marina" <so*****@nospam.com> wrote in message
news:OB**************@TK2MSFTNGP12.phx.gbl...
I am guessing you are manually attaching the event handler and you have
AutoEventWireup set to True. You need one or the other.

"Dave Hagerich" <dh*******@arclighte.com> wrote in message
news:e1*************@TK2MSFTNGP09.phx.gbl...
I currently have an aspx page that contains a datagrid object and every
time
the page goes through its lifecycle the Page_Load event gets called twice. I've checked my code and I'm not manually calling it anywhere so the
server
must be doing it. Can anybody tell me why? and is it possible to stop it? Im using if(!IsPostBack) to see it its a reload and both calls are made
before the IsPostBack is set to true. Any help would be appreciated.

Thanks,
Dave


Nov 19 '05 #3

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

Similar topics

13
2558
by: z. f. | last post by:
Hi, i have a class that is derived from System.Web.UI.Page, and this is the class i use in my application as PageBase. all other page classes are deriverd from my PageBase instead of the...
1
3930
by: Jon | last post by:
Hi, I've set up a new web form (new.aspx) that inherits a BasePage class. The new web form contains an override Page_Load event. In BasePage, Page_Load is declared 'virtual'. In the new web...
6
5928
by: Dot net work | last post by:
I've read quite a few threads on these groups about this. When someone says the following: "My Page_Load gets called twice on a button click postback" The replies are: "Do you have...
14
13089
by: V. Jenks | last post by:
I'm a little rusty having not touched .NET for 6 months and I can't remember why Page_Load is happening twice in this code: private void Page_Load(object sender, System.EventArgs e) {...
1
1551
by: Rippo | last post by:
Hi I have a Master page that opens up a db connection, performs a couple of global routines in the page_load event. All of my other web pages in my web app then inherits this Master Page I...
3
8703
by: Imran Aziz | last post by:
Hello All, I have a search text and button that post data and my button handler filters the repeater control. However when the button is clicked the first time. The page_load event is being called...
1
6920
by: puja | last post by:
hi all, I have this .aspx page for which the Page_load event occurs twice. I found out while debugging. After searching google, I tried checking with Page.Ispostback method and also had...
11
2675
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...
2
3224
by: =?Utf-8?B?SGV6YWw=?= | last post by:
Hi, I am trying to add a new record to a table but everytime I click the button, somehow it saves the record twice... I've created a stored procedure to insert records into a table and I called...
0
6905
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...
0
7041
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,...
0
5331
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4772
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4478
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...
0
2994
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2980
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1299
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 ...
0
178
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...

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.