Thanks to your example I Solved it. Once I stopped worrying, lol, I placed this example code on every stage of the page life cycle:
If IsPostBack
Then
If
Session("name")
IsNotNothingThen
TextBox2.Text = Session("name")
EndIf
Label2.text = Session("name")
+ "
page Init"
EndIf
The save session obviously returned a value and the prerender returned a value but the other stages returned only the + value I added, the session value was not returned although we know that it exists - so I placed my script call in the prerender stage
of the page cycle and achieved what I wanted.
I still have to go away and read to understand why after a button click the prerender accepts a postback argument, but that the init, initcomplete, preload and the load stages of the page cycle do not? I( did read somewhere that a button doesnt actually
cause a postback, rather that it causes a submit action which in the life cycle of a page is interpretated somewhat differently?). Still I am learning. Thanks for your help. Hope this might help someone else sometime.
Marked as answer by rayh1955 on May 14, 2012 01:15 PM
RayH1955
Member
99 Points
42 Posts
Re: session variable, viewstare variable and hidden field return null values
May 14, 2012 01:15 PM|LINK
Hi Mamba, again.
Thanks to your example I Solved it. Once I stopped worrying, lol, I placed this example code on every stage of the page life cycle:
If IsPostBack Then
If Session("name") IsNot Nothing Then
TextBox2.Text = Session("name")
End If
Label2.text = Session("name") + " page Init"
End If
The save session obviously returned a value and the prerender returned a value but the other stages returned only the + value I added, the session value was not returned although we know that it exists - so I placed my script call in the prerender stage of the page cycle and achieved what I wanted.
I still have to go away and read to understand why after a button click the prerender accepts a postback argument, but that the init, initcomplete, preload and the load stages of the page cycle do not? I( did read somewhere that a button doesnt actually cause a postback, rather that it causes a submit action which in the life cycle of a page is interpretated somewhat differently?). Still I am learning. Thanks for your help. Hope this might help someone else sometime.