473,796 Members | 2,482 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ViewState timing driving me nuts - please help

Can someone please tell me when the ViewState is loaded? My
understanding, based on
http://msdn.microsoft.com/library/de...nLifecycle.asp
is that it should be loaded before the Page_Load event, however, given
the following code I don't get the expected results.
private void Page_Load(objec t sender, System.EventArg s e)
{
if (Page.IsPostBac k & ViewState["CurrentTab "] != null)
{
_currentTab = (PageTabs)ViewS tate["CurrentTab "];
}
paintTabStrips( );
}
The ViewState is set during the first call to the page. And just to be
sure of it, when I step through this code on the first iteration
(Page.IsPostBac k=false) the value is in the ViewState, however on
PostBacks it is not there!!! AAARRRRGGGHHH!! !!!

Am I missing something fundamental or is it just my mind that has gone
lost?

Thanks

Feb 16 '06 #1
6 1279
dnz
Hi Frank,

what is the type of PageTabs?
Frank skrev:
Can someone please tell me when the ViewState is loaded? My
understanding, based on
http://msdn.microsoft.com/library/de...nLifecycle.asp
is that it should be loaded before the Page_Load event, however, given
the following code I don't get the expected results.
private void Page_Load(objec t sender, System.EventArg s e)
{
if (Page.IsPostBac k & ViewState["CurrentTab "] != null)
{
_currentTab = (PageTabs)ViewS tate["CurrentTab "];
}
paintTabStrips( );
}
The ViewState is set during the first call to the page. And just to be
sure of it, when I step through this code on the first iteration
(Page.IsPostBac k=false) the value is in the ViewState, however on
PostBacks it is not there!!! AAARRRRGGGHHH!! !!!

Am I missing something fundamental or is it just my mind that has gone
lost?

Thanks


Feb 16 '06 #2
I'm wouldn't have though it would matter but:

[Flags]
public enum PageTabs
{
SummaryList = 0x1,
DebtorInfo = 0x2,
AdditionalInfo = 0x4,
SkipDetails = 0x8,
AccountInfo = 0x10,
AddressHistory = 0x20,
Invoices = 0x40,
AddressInfo = 0x80,
Search = 0x100,
Results = 0x200,
CreditReport = 0x400,
QMail = 0x800,
Diary = 0x1000
}

Feb 16 '06 #3
Have u ensured that the viewstate property on the control is set to True?

"Frank" <mr********@hot mail.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
Can someone please tell me when the ViewState is loaded? My
understanding, based on
http://msdn.microsoft.com/library/de...nLifecycle.asp
is that it should be loaded before the Page_Load event, however, given
the following code I don't get the expected results.
private void Page_Load(objec t sender, System.EventArg s e)
{
if (Page.IsPostBac k & ViewState["CurrentTab "] != null)
{
_currentTab = (PageTabs)ViewS tate["CurrentTab "];
}
paintTabStrips( );
}
The ViewState is set during the first call to the page. And just to be
sure of it, when I step through this code on the first iteration
(Page.IsPostBac k=false) the value is in the ViewState, however on
PostBacks it is not there!!! AAARRRRGGGHHH!! !!!

Am I missing something fundamental or is it just my mind that has gone
lost?

Thanks

Feb 16 '06 #4
This is not for a control per se...it's just the ViewState bag for the
page, and yes, it is enabled for the page.

Thanks,
Frank
Jason Myers wrote:
Have u ensured that the viewstate property on the control is set to True?

"Frank" <mr********@hot mail.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
Can someone please tell me when the ViewState is loaded? My
understanding, based on
http://msdn.microsoft.com/library/de...nLifecycle.asp
is that it should be loaded before the Page_Load event, however, given
the following code I don't get the expected results.
private void Page_Load(objec t sender, System.EventArg s e)
{
if (Page.IsPostBac k & ViewState["CurrentTab "] != null)
{
_currentTab = (PageTabs)ViewS tate["CurrentTab "];
}
paintTabStrips( );
}
The ViewState is set during the first call to the page. And just to be
sure of it, when I step through this code on the first iteration
(Page.IsPostBac k=false) the value is in the ViewState, however on
PostBacks it is not there!!! AAARRRRGGGHHH!! !!!

Am I missing something fundamental or is it just my mind that has gone
lost?

Thanks


Feb 16 '06 #5
dnz
Hi Frank,

I cannot reproduce your problem. When I do as you described, it works
as it should.

Try Nikhil Khotari's Web Development Helper (
http://www.nikhilk.net/Project.WebDevHelper.aspx ) and inspect the
serialized viewstate in the hidden field in the html.

Feb 17 '06 #6
Here is a break-down of methods that are called on the page. What I
find strange is that the ViewState property bag is not null when I
check in Page_Load, just the value I need.

Page.IsPostBack == false:

OnInit
InitializeCompo nent
(custom - ignore) InitializeSessi on
(custom - ignore) paintPanel
(custom - ignore) buildPanelDebto rInfo
(custom - ignore) bindPhoneNumber Grid
(datagrid - ignore) _uiPhoneNumberG rid_ItemCreated
(datagrid - ignore) _uiPhoneNumberG rid_ItemDataBou nd
(datagrid - ignore) _uiPhoneNumberG rid_ItemCreated
(datagrid - ignore) _uiPhoneNumberG rid_ItemDataBou nd
(datagrid - ignore) _uiPhoneNumberG rid_ItemCreated
(datagrid - ignore) _uiPhoneNumberG rid_ItemDataBou nd
(datagrid - ignore) _uiPhoneNumberG rid_ItemCreated
(datagrid - ignore) _uiPhoneNumberG rid_ItemDataBou nd
(datagrid - ignore) _uiPhoneNumberG rid_ItemCreated
(datagrid - ignore) _uiPhoneNumberG rid_ItemDataBou nd
(custom - ignore) paintPanel **********
ViewState["CurrentTab "] set here
Page_Load **********
ViewState["CurrentTab "] != null
(custom - ignore) paintTabStrips

Page.IsPostBack == true:

OnInit
InitializeCompo nent
(custom - ignore) InitializeSessi on
(datagrid - ignore) _uiPhoneNumberG rid_ItemCreated
(datagrid - ignore) _uiPhoneNumberG rid_ItemCreated
(datagrid - ignore) _uiPhoneNumberG rid_ItemCreated
(datagrid - ignore- ignore) _uiPhoneNumberG rid_ItemCreated
(datagrid - ignore) _uiPhoneNumberG rid_ItemCreated
Page_Load **********
ViewState["CurrentTab "] == null
(custom - ignore) paintTabStrips
(custom - ignore) _uiDebtorInfoSa ve_Click
(custom - ignore) persistData
(custom - ignore) _uiDebtorInfoSa ve_Click

I am going absolutely crazy with this. This is not the only page I
have that seems to be *randomly* managing ViewState.


dnz wrote:
Hi Frank,

I cannot reproduce your problem. When I do as you described, it works
as it should.

Try Nikhil Khotari's Web Development Helper (
http://www.nikhilk.net/Project.WebDevHelper.aspx ) and inspect the
serialized viewstate in the hidden field in the html.


Feb 20 '06 #7

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

Similar topics

6
1613
by: Keiron Waites | last post by:
Please see the problem in action here: http://www.leadbullet.biz/contact.php If you mouse over the fields, you will see that text is shown on the right. The text makes the other fields move when it is shown - even though the width of the text is less than the width of the field. WHY? This is driving me nuts - please help! TIA,
1
1466
by: Bill | last post by:
I've been chasing this problem around for a few days now and its driving me nuts. We keep getting these errors in our web application intermittently. I can't cause the problem myself to attempt to reproduce. From the reading I've done, people run into this when urlencoding and urldecoding improperly, but I don't think that is the case here. It looks like there's an issue with the ViewState...perhaps its getting corrupted or truncated...
12
1617
by: Marty | last post by:
It seems all of the sudden that user controls that contain images are referencing image sources relative to the document that I drop the control on. This obviously does not work beacuase the image source is relative to the user control, not necessarily the form. Can anyone tell me why this would be the case?
0
984
by: Simon Harris | last post by:
Ok, this really is driving me nuts!!! :( 'All' I am trying to do is get the value of a named element. My XML doc is: <?xml version="1.0" encoding="utf-16" standalone="yes" ?> - <Page> <Title>Test</Title> <MetaKeywords>Test</MetaKeywords>
4
1659
by: trond | last post by:
Hello all, Before I start I'd like to point out that I am a complete novice when it comes to asp.net - My background is in network and operating systems, and although I have been doing a bit of hobby programming in vb.net and web programming in asp/vbscript in the past, I am pretty much a beginner at asp.net. What I'm trying to do, is to take the "PersonalHomePage" starter kit that MS supplies with VS2005 and tweak it a bit, to make it...
2
1512
by: mitsura | last post by:
Hi, I need to read a simle XML file. For this I use the SAX parser. So far so good. The XML file consist out of number of "Service" object with each object a set of attributes. I read through the XML file and for each "<Service>" entry I create a new service object. When I am in the "<Service>" part of the XML file and I encounter
2
1548
by: julie.siebel | last post by:
Google apparently ate my original post to this (grr) so this'll be a bit more vague than the initial post, but...*sigh*. Javascript is not my forte, and I apologize for the acky-ness of the code. I'm working on a page for a travel company. There's way too much going on with it/on it, but I'm kind of stuck at this point - the client loves it, so I have to solve this problem.
1
153
by: Sanjay Pais | last post by:
We keep getting this error on one of our web pages. I have absolutely no idea which control is causing the problem. How do i diagnose and fix this problem? It has been driving us nuts!
1
1831
balabaster
by: balabaster | last post by:
Hi, I've been bashing my head against this since Friday and it's driving me nuts. I've got an EntitySet(Of T) (LINQ) which is serialized to/from the viewstate by overriding the LoadViewState and SaveViewState methods. I've confirmed that this object is serialized/deserialized properly - so I know this bit is working as it should and when it should. I have created a table template in which I have a header row which is just header text for...
0
9525
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10452
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10221
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10169
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9050
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.