Re: Page_Load Event Fires Twice
From: Sam Santiago (ssantiago_at_n0spam-SoftiTechture.com)
Date: 12/24/04
- Previous message: Cello: "Authorization and Profile Application Block generates errors when using whithin Web Application"
- In reply to: Dianna: "Re: Page_Load Event Fires Twice"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 24 Dec 2004 15:13:24 -0800
Are you using ASP.NET 2.0 since you mention master pages? What do you do in
the selectedindexchanged event handler? Also, you are not explicitly
setting the value of IsPostBack? Can you check your weblog to see if the
page is being posted twice to the server or you are running through the code
twice somehow.
Thanks,
Sam
-- _______________________________ Sam Santiago ssantiago@n0spam-SoftiTechture.com http://www.SoftiTechture.com _______________________________ "Dianna" <Dianna@discussions.microsoft.com> wrote in message news:1926C2A1-6D93-4854-9486-B14DF45C1D04@microsoft.com... > Sorry Sam, this error does occur on my laptop as well. > > Here is a bit more info that I found debugging: > > I have SelectedIndexChanged event and here is how the code seems to be > running when I change the index in my listbox: > > Master Page: Checks 'Not IsPostBack' which is set to True so it does not > run Page_load. > > Control Page: Check 'Not IsPostBack' which is set to True so it does not > run Page_load. > > Then... > > Hits the 'SelectedIndexChanged' runs code and then sets IsPostBack to > False > and then it runs through all the Page_load events again. > > Evidentally, the selectedindexchanged seems to be causing the problem...?? > > > "Dianna" wrote: > >> Hi Sam, >> >> I am not using any client side script for this particular page. I notice >> one thing, this occurs only on my PC, not on my laptop (could be IE >> version, >> Operating System....???). >> >> Thanks, >> Dianna >> >> >> "Sam Santiago" wrote: >> >> > Most likely your page is being submitted twice. This is easy to verify >> > if >> > you look at your web log - you will see two entries for the same page >> > with >> > almost the same timestamp. Frequently, the cause of this behavior is >> > JavaScript in your page. For example, if you have a Submit button with >> > an >> > OnClick event handler and you do a Form.Submit in your JavaScript you >> > are >> > effectively submitting your form twice. >> > >> > Thanks, >> > >> > Sam >> > >> > -- >> > _______________________________ >> > Sam Santiago >> > ssantiago@n0spam-SoftiTechture.com >> > http://www.SoftiTechture.com >> > _______________________________ >> > "Dianna" <Dianna@discussions.microsoft.com> wrote in message >> > news:FA7AB907-7647-43B2-944D-0A5C101F9340@microsoft.com... >> > >I have seen a few discussions regarding the above but no real >> > >resolution or >> > > reason for why this is happening. >> > > >> > > I have an aspx page with a couple of user-controls (web) and a >> > > datagrid >> > > and >> > > the page loads twice. >> > > >> > > I wonder if this is an IE issue. When I tried on my laptop the error >> > > did >> > > not occur.... However, on my PC at work it always occurs. >> > > >> > > I checked AutoEventWireup on all pages and controls and all are set >> > > to >> > > false. >> > > >> > > Does anyone have any information on this one? >> > > >> > > Thanks, >> > > Dianna >> > > (Below is page_load code --- as you can see, nothing fancy here) >> > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e >> > > As >> > > System.EventArgs) Handles MyBase.Load >> > > >> > > If Not Page.IsPostBack Then >> > > BindDataHistory() >> > > BindDataEpisodes() >> > > BindDataDetail(MastId,SeriesId) >> > > >> > > End If >> > >> > >> >
- Previous message: Cello: "Authorization and Profile Application Block generates errors when using whithin Web Application"
- In reply to: Dianna: "Re: Page_Load Event Fires Twice"
- Messages sorted by: [ date ] [ thread ]
Loading