Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 4th, 2004, 12:27 PM
Registered User
 
Join Date: Oct 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to lphiedrag Send a message via MSN to lphiedrag
Default Page_Load method not executed on initial load

Hello Guys:

I have a standard aspx page with textboxes populated through a dataset.

I have a button that updates the fields from the textboxes to the database using sqlcommand without going through the dataset and then redirects to the home page. This is basically a user's personal information update page.

If I use a hyperlink on the homepage to go back to the edit page, the textboxes are not populated with the new information. I am calling the population function in the page_load event handler (if not postback).

I placed a breakpoint on the even handler and noticed that the breakpoint only catches after I'm on the page and press the re_load button on the browser, and then it is executed.

Also strange, is that the code inside the if(not ispostback) is executed and then my text boxes are filled with the new values.

I would like this behavior to take place when i revisit the page automatically instead of me having to press the reload button.

Any help would be greatly appreciated.

 
Old October 4th, 2004, 02:40 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Could you post any code? In addition, if you want the behavior to happen when the page is revisited, might you want if (Page.IsPostback)?

Brian
 
Old October 4th, 2004, 03:06 PM
Registered User
 
Join Date: Oct 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to lphiedrag Send a message via MSN to lphiedrag
Default

private void Page_Load(object sender, System.EventArgs e)
        {
        if(!Page.IsPostBack)
            {
                Fill the fields with User's information from database.
            }
        }

private void Submit_Click(object sender, System.EventArgs e)
        {
            Update the database with textbox values and Response.Redirect("Homepage.aspx").

        }

What I mean by leaving the page is that after the button is clicked, the database is updated, I was redirected back to the homepage. (another aspx page) If I go back to the Info page, by clicking a hyperlink using response.redirect, I get to that page but I see the values in the text box as if nothing was changed from the first visit. If I press the reload button on the browser, then the code inside the Page_load If(!ispostback) is run and then i see the fields updated.


 
Old October 4th, 2004, 03:18 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Are you specifying output caching for that page?
 
Old October 4th, 2004, 03:23 PM
Registered User
 
Join Date: Oct 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to lphiedrag Send a message via MSN to lphiedrag
Default

No, there is no output cache on this page or anywhere else in the project.

 
Old October 23rd, 2004, 09:19 AM
Authorized User
 
Join Date: Oct 2004
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

put your page in trace mode, and see what it is happening

wagner reatto
 
Old October 25th, 2004, 07:44 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Could you also post any necessary additional code, such as how you do the redirect?

Brian

Brian
 
Old October 25th, 2004, 03:41 PM
Registered User
 
Join Date: Oct 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to lphiedrag Send a message via MSN to lphiedrag
Default

Thank you all for your help. Apparently it was a setting on my browser that my tech set that said to "always use local copy".

This was what caused this weird problem.

Regards.






Similar Threads
Thread Thread Starter Forum Replies Last Post
VBScript Sub is executed twice.... jaijavan20194 VBScript 4 April 30th, 2009 09:05 PM
GridView - initial load and sort direction snufse ASP.NET 2.0 Basics 0 October 30th, 2008 08:20 PM
xslt.Load method in c# takes about 8 seconds pradeepn XSLT 2 August 31st, 2007 03:53 PM
Initial Page is slow to load bjoneskc BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 2 July 7th, 2007 11:14 AM
Load external script within Page_Load Event kwilliams General .NET 0 October 9th, 2006 10:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.