473,804 Members | 3,229 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Preserving viewstate across multiple pages

I have an aspx page (page1.aspx) that post back to another aspx page
(page2.aspx)
“page2.aspx has a button called back, when the user click on this button it
is supposed to return to “page1.aspx , when the user returns to “page1.aspx
I want to restore the viewstate of the page so the page would have the same
data as the user left it.
How can I achieve this behavior?
Thanks

Nov 19 '05 #1
2 1784
check out Page.SavePageSt ateToPersistenc eMedium /
LoadPageStateFr omPersistenceMe dium
use this to save the viewstate off somewhere ( Session / Cache / DB / ... )
and reload it as required


"GHQ Dev" <GH****@discuss ions.microsoft. com> wrote in message
news:D2******** *************** ***********@mic rosoft.com...
I have an aspx page (page1.aspx) that post back to another aspx page
(page2.aspx)
"page2.aspx " has a button called back, when the user click on this button it is supposed to return to "page1.aspx ", when the user returns to "page1.aspx " I want to restore the viewstate of the page so the page would have the same data as the user left it.
How can I achieve this behavior?
Thanks

Nov 19 '05 #2
You are correct.

And I apologize , I have too many things cooking at one time.

The way we do this is by a custom state management scheme that saves the
page state before a new page is requested and restores the state every time
the page is requested regardless of POST. Basically before you navigate
away from the page you loop through the controls on the page saving off any
values of interest. And when the page is navigated to you do the same thing
in reverse.

clear as mud right ?

"GHQ Dev" <GH****@discuss ions.microsoft. com> wrote in message
news:D4******** *************** ***********@mic rosoft.com...
Hello,
there is a big probelm with this solution that I was unable to solve,
Page.LoadPageSt ateFromPersiste nceMedium is called only when the page is post backed and it is never called when the page is loaded for the first time.
Is there is a way to force LoadPageStateFr omPersistenceMe dium
to be called each time the page is requested?
Thanks
"gerry" wrote:
check out Page.SavePageSt ateToPersistenc eMedium /
LoadPageStateFr omPersistenceMe dium
use this to save the viewstate off somewhere ( Session / Cache / DB / .... ) and reload it as required


"GHQ Dev" <GH****@discuss ions.microsoft. com> wrote in message
news:D2******** *************** ***********@mic rosoft.com...
I have an aspx page (page1.aspx) that post back to another aspx page
(page2.aspx)
"page2.aspx " has a button called back, when the user click on this
button it
is supposed to return to "page1.aspx ", when the user returns to

"page1.aspx "
I want to restore the viewstate of the page so the page would have the

same
data as the user left it.
How can I achieve this behavior?
Thanks


Nov 19 '05 #3

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

Similar topics

5
7258
by: Michael Albanese | last post by:
Can you save objects a (custom class) to Viewstate and then get them on a later page?? I have a custom class for an ASP.Net application that I would like to make available across several web pages. For example: page1.aspx accepts a users's name, age and gender, instantiated the new class and redirects to page2.aspx
16
5154
by: TTroy | last post by:
Hello, I'm relatively new to C and have gone through more than 4 books on it. None mentioned anything about integral promotion, arithmetic conversion, value preserving and unsigned preserving. And K&R2 mentions "signed extension" everywhere. Reading some old clc posts, I've beginning to realize that these books are over-generalizing the topic. I am just wondering what the difference between the following pairs of terms are: 1)...
9
21653
by: John Kirksey | last post by:
I have a page that uses an in-place editable DataGrid that supports sorting and paging. EnableViewState is turned ON. At the top of the page are several search fields that allow the user to filter the results in the grid. Say you filter the grid for records that have a certain condition set to "NO" (in this case a checkbox). In this scenario the search returns one result. If I then check the checkbox ("YES") and save it, I now get my message...
1
1711
by: Sky | last post by:
Although I've been using C# for the last month or so, and accepting out of blind faith the ViewState, I do have some nagging questions about it... can you help verify the following statements? Application is across all sessions. Session is across all pages. ViewState is sort of like Session, but for only one page. <-- Correct statement? Session is stored between page requests, somewhere in mem or IIS files --
2
3100
by: Fred Newton | last post by:
Just wondering if there are any strong arguments one way or the other for storing a small value (6 bytes) in the ViewState vs. Session state. The value is needed in only one page in a large ASP.NET app. I'm interested in knowing performance differences specifically and anything a beginning ASP.NET developer might not be thinking about. FWIW: I'm *not* considering the 3rd obvious option - cookies. Thanks!
3
4578
by: RCS | last post by:
I have an app that I have different "sections" that I want to switch back and forth from, all while having the server maintain viewstate for each page. In other words, when I am on Page1.aspx and set textboxes, radio buttons, etc - that viewstate is fine. Then I have a linkbutton that does a Server.Transfer over to Page2.aspx. When I Server.Transfer back to Page1.aspx, the viewstate info is lost. I ran across another example of this last...
1
1824
by: Joe Abou Jaoude | last post by:
hi, I just want simply to preserve some data in my usercontrol on postbacks. so I added this property in my UserControl Protected Property MyProperty() As String Get If Not ViewState("xxx") Is Nothing Then Return ViewState("xxx")
2
3166
by: dotComPaJi | last post by:
Hello There, I have a simple question. In one of my program if I use ViewState then program does not work as expected(nothing is displayed in GridView but If I use Session State then it works fine. Any idea??? ----------------------------------------------- //Does not work as expected
5
4123
by: John Kotuby | last post by:
Hi all, After more than a year programming with ASP.NET 2.0 and VB I am still finding it difficult to leave some habits from classic ASP behind. this is particularly true with cross-page posting. My site uses Master pages and user controls. On an Advanced Search page I have numerous entry boxes and listboxes (keywords, categories, etc.) which are primarily standard HTML. I post this page to a different page which lists results and...
0
9708
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9587
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
10588
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...
1
10324
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,...
1
7623
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
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
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2998
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.