Welcome to Dream.In.Code
Getting Help is Easy!

Join 135,955 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,651 people online right now. Registration is fast and FREE... Join Now!




ASP.NET Page Life Cycle Overview

 
Reply to this topicStart new topic

ASP.NET Page Life Cycle Overview, confused

rgfirefly24
7 May, 2008 - 11:37 AM
Post #1

D.I.C Regular
Group Icon

Joined: 7 Apr, 2008
Posts: 330



Thanked: 5 times
Dream Kudos: 150
My Contributions
Ok i have read and reread this article probably a 100 times and am still confused.

http://msdn.microsoft.com/en-us/library/ms178472.aspx

Basically I have a postback trigger a C# function, which builds a session variable, and also populate a confirmbuttonextender.

now, i know that the confirmbuttonextender.ConfirmText is being set to what i want by doing step over mode, but it is lagged by 2-3 submit clicks.

My question is, In the life cycle of an ASP.Net page how exactly are events fired off? I think i have something totally out of order but not sure as to what.

Page_Load code:

CODE

protected void Page_Load(object sender, EventArgs e)
    {
        
        
        ScriptManager1.RegisterAsyncPostBackControl(lbtnCaptchaRefresh);
        ScriptManager1.RegisterAsyncPostBackControl(txtPhone);

        if (!Page.IsPostBack)
        {
            ddlCountry.SelectedIndex = 47;
            tempstr = "did not work";

        }
        if (Page.IsPostBack)
        {
            BuildSession();
            
            tempstr = Session["localsendvalue"].ToString();
        }

        
    }

User is offlineProfile CardPM
+Quote Post

JasonMcAuley
RE: ASP.NET Page Life Cycle Overview
12 May, 2008 - 05:40 AM
Post #2

D.I.C Head
**

Joined: 10 Apr, 2008
Posts: 135


My Contributions
So you're saying you are stepping into the code on post back, it is successfully getting into your "Page.IsPostBack" block and it is handling your BuildSession unpredictably? Is that where your confirmbuttonextender.ConfirmText is being set? Im just a little confused as to where in your code your issue is happening.
User is offlineProfile CardPM
+Quote Post

rgfirefly24
RE: ASP.NET Page Life Cycle Overview
13 May, 2008 - 06:34 AM
Post #3

D.I.C Regular
Group Icon

Joined: 7 Apr, 2008
Posts: 330



Thanked: 5 times
Dream Kudos: 150
My Contributions
QUOTE(JasonMcAuley @ 12 May, 2008 - 06:40 AM) *

So you're saying you are stepping into the code on post back, it is successfully getting into your "Page.IsPostBack" block and it is handling your BuildSession unpredictably? Is that where your confirmbuttonextender.ConfirmText is being set? Im just a little confused as to where in your code your issue is happening.


ok, there is a textbox that causes postback. On postback i want to build a Session variable *buildsession()*, this session variable is then used in a confirmboxextender to display the session variable for the user to confirm. The confirmbuttonextender is being formed in the postback also. after the buildsession. The problem is that the confirmbox extender is not picking up the variable right away. It takes 2-3 postbacks for it to register the correct string.
User is offlineProfile CardPM
+Quote Post

JasonMcAuley
RE: ASP.NET Page Life Cycle Overview
14 May, 2008 - 04:28 AM
Post #4

D.I.C Head
**

Joined: 10 Apr, 2008
Posts: 135


My Contributions
So the confirm extender isn't getting the value until 2-3 postbacks... But if you watch the value in session, is that not storing the value? As long as its getting into session right, and being held in session, you should have access to it after the postback. In the code your provided, is tempstr not getting the session value?

This post has been edited by JasonMcAuley: 14 May, 2008 - 05:14 AM
User is offlineProfile CardPM
+Quote Post

rgfirefly24
RE: ASP.NET Page Life Cycle Overview
14 May, 2008 - 01:25 PM
Post #5

D.I.C Regular
Group Icon

Joined: 7 Apr, 2008
Posts: 330



Thanked: 5 times
Dream Kudos: 150
My Contributions
QUOTE(JasonMcAuley @ 14 May, 2008 - 05:28 AM) *

So the confirm extender isn't getting the value until 2-3 postbacks... But if you watch the value in session, is that not storing the value? As long as its getting into session right, and being held in session, you should have access to it after the postback. In the code your provided, is tempstr not getting the session value?


Yes the Session variable is getting the value correctly when it posts back. I'm still confused as to why this is. I've ended up convincing the client to allow me to use some ugly nasty looking hidden label that pops up on post back to confirm the number.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/1/08 09:13AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month