473,396 Members | 1,755 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,396 software developers and data experts.

Page Execution Order (ViewState)

I'm really stumped here. I have a couple pages where I'm using a
datagrid and a custom paging solution. I store the current page, sort
column, etc in the ViewState of the page. When a column is clicked or
the pager control (custom) is clicked I load the view state to get any
current values, then build the page accordingly...

Problem:

One of my pages works fine - paging is great and the ViewState loads as
per normal. The other page with virtually the same code does not. The
View State is null when the 'pager_navigate' event fires.

I've stepped through the code (each line in fact) and basically the
order of page execution is also identical: OnInit, Pager_Navigate (on
postback)

The difference is that in the page that works the ViewState loads its
values and thus the navigation works. On the 'broken' page, the
ViewState never loads (stepped into the Pre-Render event and the
ViewState was null.

I've checked to make sure the ViewState values are being stored before
the page renders and the ViewState has a value on both pages before
rendering.

Thoughts?

Feb 5 '06 #1
5 1484
Just a little more info:

When I parse the ViewState of the rendered page, the page that works
has the values stored properly in ViewState, the 'broken' page,
however, does not seem to rendering the ViewState values to the page.

Again, on the pre-render event I am able to see the value in ViewState,
in fact I Response.Write(ViewState["CurrentPage"]); and the value is
displayed on the screen.

Feb 5 '06 #2
Hi Frank,

ViewState uses hidden element in page to store data, so it’s only available
in page not crossing pages. If you need to share data in pages, SessionState
is an option.

HTH

Elton Wang

"Frank" wrote:
I'm really stumped here. I have a couple pages where I'm using a
datagrid and a custom paging solution. I store the current page, sort
column, etc in the ViewState of the page. When a column is clicked or
the pager control (custom) is clicked I load the view state to get any
current values, then build the page accordingly...

Problem:

One of my pages works fine - paging is great and the ViewState loads as
per normal. The other page with virtually the same code does not. The
View State is null when the 'pager_navigate' event fires.

I've stepped through the code (each line in fact) and basically the
order of page execution is also identical: OnInit, Pager_Navigate (on
postback)

The difference is that in the page that works the ViewState loads its
values and thus the navigation works. On the 'broken' page, the
ViewState never loads (stepped into the Pre-Render event and the
ViewState was null.

I've checked to make sure the ViewState values are being stored before
the page renders and the ViewState has a value on both pages before
rendering.

Thoughts?

Feb 5 '06 #3
Just to clarify, this is two separate pages I'm talking about whose
behavior appears to be different. The data is contained within the
respective pages not being shared across pages.

Like I mentioned, the first page seems to store the viewstate properly
in the 'hidden' field but the second does not. Viewstate is enabled on
both pages but something weird is going on.

Thanks

Feb 5 '06 #4
Its a little difficult to diagnose this with no substance. In order to be
able to do this, we would need the code here. Almost without question there
is a difference between the two pages/code behind and its just a case of
fine diagnostics to resolve it. Usually its a question of forgetting to do
something or failing to remember something is happening in the order of
events. In any case, think carefully about the firing order and map out what
is going on on a bit of paper ( probably a large bit ) and then you may have
a chance of solving it without posting the code , otherwise there is no
choice but to post your code.

--
Terry Burns
http://TrainingOn.net
"Frank" <mr********@hotmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Just to clarify, this is two separate pages I'm talking about whose
behavior appears to be different. The data is contained within the
respective pages not being shared across pages.

Like I mentioned, the first page seems to store the viewstate properly
in the 'hidden' field but the second does not. Viewstate is enabled on
both pages but something weird is going on.

Thanks

Feb 5 '06 #5
Sorry I misunderstood your question.

One possible reason, maybe (just maybe), is that the broken page’s
EnableViewState to be set false. In that case, after you assign a ViewState
variable, it exists even in PreRender event, but it is not really rendered to
browser.
Elton

"Frank" wrote:
Just to clarify, this is two separate pages I'm talking about whose
behavior appears to be different. The data is contained within the
respective pages not being shared across pages.

Like I mentioned, the first page seems to store the viewstate properly
in the 'hidden' field but the second does not. Viewstate is enabled on
both pages but something weird is going on.

Thanks

Feb 5 '06 #6

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

Similar topics

2
by: laredotornado | last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to have my Javascript function execute from the BODY's "onload" method, but if there is already an onload method defined, I would...
1
by: | last post by:
Hi guys! I am a beginner with aspx (i have some background with .asp). And i am trying tu use a 'code-behind' page in order to execute all transactions in that page and leave as clean as possible...
4
by: Kevin Phifer | last post by:
Ok, before anyone freaks out, I have a solution I need to create that gathers content from maybe different places. Each one can return a <form> in the html, so its the classic can't have more than...
1
by: Sorin Sandu | last post by:
I have a simple page with a grid on it based on a stored procedure Sometimes I get this error : Request timed out. Description: An unhandled exception occurred during the execution of the current...
7
by: Jason | last post by:
Can anybody help on the following error : The viewstate is invalid for this page and might be corrupted. Description: An unhandled exception occurred during the execution of the current web...
5
by: Joe Reazor | last post by:
I've got an asp.net page that has approximately 1,440 controls on it. You must think I'm crazy, but we need to have the page organized in this fashion. As you can imagine, the page takes a very...
5
by: DCC-700 | last post by:
I am using ASP.Net with VB on the 1.1 Framework running on Win XP Pro. I am trying to gauge the time it takes to sort a datagrid using different code sets. But when I am debugging the page there...
3
by: Nathan Sokalski | last post by:
I am recieving the following error on the second postback of a page I have written: The state information is invalid for this page and might be corrupted Stack Trace: ...
3
by: Ken Shimizu | last post by:
I get an error when submitting an .ASPX page in Safari beta, MAC and PC document.getElementbyId(‘FolderBrowser’).submit(); After the server side code has executed without problems I get the...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...
0
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...
0
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...
0
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,...

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.