473,320 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

ViewState not available on Page_Init?

If I set a ViewState variable in the page_load event, then try to access
that same ViewState variable in the Page_Init event *after* a postback, the
variable's value is different. I only set it in this one place.

What is happening?

Thanks,

Craig Buchanan
Nov 18 '05 #1
4 4736
Page_Init happens before the state is recovered..

Regards
Jose

"Craig Buchanan" <so*****@somewhere.com> escribió en el mensaje
news:e4**************@TK2MSFTNGP09.phx.gbl...
If I set a ViewState variable in the page_load event, then try to access
that same ViewState variable in the Page_Init event *after* a postback, the variable's value is different. I only set it in this one place.

What is happening?

Thanks,

Craig Buchanan

Nov 18 '05 #2
The LoadViewState Event occurs just after the Init Event. You want to access
it in some later Event. Shouldn't be hard, as the Init and LoadViewState are
the first 2.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Craig Buchanan" <so*****@somewhere.com> wrote in message
news:e4**************@TK2MSFTNGP09.phx.gbl...
If I set a ViewState variable in the page_load event, then try to access
that same ViewState variable in the Page_Init event *after* a postback, the variable's value is different. I only set it in this one place.

What is happening?

Thanks,

Craig Buchanan

Nov 18 '05 #3
Kevin-

Thanks for the response. Why don't I see the LoadViewState event in the
page event list?

Craig

"Kevin Spencer" <ke***@takempis.com> wrote in message
news:eg**************@tk2msftngp13.phx.gbl...
The LoadViewState Event occurs just after the Init Event. You want to access it in some later Event. Shouldn't be hard, as the Init and LoadViewState are the first 2.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Craig Buchanan" <so*****@somewhere.com> wrote in message
news:e4**************@TK2MSFTNGP09.phx.gbl...
If I set a ViewState variable in the page_load event, then try to access
that same ViewState variable in the Page_Init event *after* a postback,

the
variable's value is different. I only set it in this one place.

What is happening?

Thanks,

Craig Buchanan


Nov 18 '05 #4
Hi Craig,

It is a common Event of all System.Web.UI.Control classes. The following
link shows the entire Control Execution LifeCycle for all Server Controls:

http://msdn.microsoft.com/library/de...nLifecycle.asp

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Craig Buchanan" <so*****@somewhere.com> wrote in message
news:#H**************@TK2MSFTNGP12.phx.gbl...
Kevin-

Thanks for the response. Why don't I see the LoadViewState event in the
page event list?

Craig

"Kevin Spencer" <ke***@takempis.com> wrote in message
news:eg**************@tk2msftngp13.phx.gbl...
The LoadViewState Event occurs just after the Init Event. You want to

access
it in some later Event. Shouldn't be hard, as the Init and LoadViewState

are
the first 2.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Craig Buchanan" <so*****@somewhere.com> wrote in message
news:e4**************@TK2MSFTNGP09.phx.gbl...
If I set a ViewState variable in the page_load event, then try to access that same ViewState variable in the Page_Init event *after* a
postback, the
variable's value is different. I only set it in this one place.

What is happening?

Thanks,

Craig Buchanan



Nov 18 '05 #5

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

Similar topics

0
by: wASP | last post by:
I thought it was something relatively simple: ViewState = SomeObj; Then: SomeObj = ViewState; So, in my own code, I have this on the initial load:
1
by: John | last post by:
Hi all, I have a problem with viewstate being maintained. I use LoadControl to load a user control and the data is sent down to the client correctly. However, when I change some data and post...
3
by: Steve Drake | last post by:
All, I have a CONTROL that contains 1 control (Control ONE), the 1 control that it can contain 1 or 2 control (Control A and B). Control A, raises and event and Control ONE receives this event...
4
by: Chuck Ritzke | last post by:
Hi, I've searched the newsgroup and other sources to understand how to handle runtime controls and see I'm not the only one who's confused, but I'm still not quite sure of the best way to handle...
6
by: Gauthier Segay | last post by:
Hello, I've problem on subsequent postbacks after a Server.Transfer was done. In our application framework we have a method that pass parameters (via HttpContext.Items) and navigate to another...
6
by: hitendra15 | last post by:
Hi I have created web user control which has Repeater control and Linkbutton in ItemTemplate of repeater control, following is the code for this control On first load it runs fine but when...
9
by: Alexander van Doormalen | last post by:
I have a situation that user controls are dynamically loaded within a page. To know which control to 're-add' to the page I saved the control path in the ViewState. This Control is added using...
2
by: Steph | last post by:
Hello, i found a bug ? or an incompetence of my share ! I've 1 aspx and 3 ascx level : as : Default.aspx : PlaceHolder1 < Page_Init : LoadControl(1.ascx) module.ascx : PlaceHolder1 <...
0
by: Aaronius | last post by:
I do admit I am fairly new to ASP.NET. With that, I've also poured over dozens of websites and forum posts, sifted through pages of text, and spent hours stuck on this problem. I'm now pleading for...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.