473,785 Members | 2,847 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I just want to use server.transfer and still have viewstate

I want to use server.transfer to go to a new aspx page. I want to be able to
still have the viewstate from the previous page. I have researched this and
see a lot about it, but I can't find a good straight forward example. Does
anyone know how to do this? I'm using asp.net 2.0 and vb.net. Thanks.
Feb 22 '06 #1
3 1544
Lanem,
Viewstate is specific to the page it pertains to and is only available when
that page posts back to itselft.

With Server.Transfer , you could look at ways to pass the previous page's
state either in Session, or HttpContext Items collection. In ASP.NET 2.0 you
have cross - page postbacks and the Page class exposes a PreviousPage
property. And, there are other solutions as well, But ViewState isn't one of
them.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"lanem" wrote:
I want to use server.transfer to go to a new aspx page. I want to be able to
still have the viewstate from the previous page. I have researched this and
see a lot about it, but I can't find a good straight forward example. Does
anyone know how to do this? I'm using asp.net 2.0 and vb.net. Thanks.

Feb 22 '06 #2
I have created some values in the original page like this:
ViewState("theS tring") = "Hello World".

Can I still reference these values using PreviousPage on the second page? I
know I can get the values of controls that are on the original page, but what
about these kinds of values?

Thanks.

"Peter Bromberg [C# MVP]" wrote:
Lanem,
Viewstate is specific to the page it pertains to and is only available when
that page posts back to itselft.

With Server.Transfer , you could look at ways to pass the previous page's
state either in Session, or HttpContext Items collection. In ASP.NET 2.0 you
have cross - page postbacks and the Page class exposes a PreviousPage
property. And, there are other solutions as well, But ViewState isn't one of
them.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"lanem" wrote:
I want to use server.transfer to go to a new aspx page. I want to be able to
still have the viewstate from the previous page. I have researched this and
see a lot about it, but I can't find a good straight forward example. Does
anyone know how to do this? I'm using asp.net 2.0 and vb.net. Thanks.

Feb 22 '06 #3
No, not with Server.Transfer . Just store your values in Session instead.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"lanem" wrote:
I have created some values in the original page like this:
ViewState("theS tring") = "Hello World".

Can I still reference these values using PreviousPage on the second page? I
know I can get the values of controls that are on the original page, but what
about these kinds of values?

Thanks.

"Peter Bromberg [C# MVP]" wrote:
Lanem,
Viewstate is specific to the page it pertains to and is only available when
that page posts back to itselft.

With Server.Transfer , you could look at ways to pass the previous page's
state either in Session, or HttpContext Items collection. In ASP.NET 2.0 you
have cross - page postbacks and the Page class exposes a PreviousPage
property. And, there are other solutions as well, But ViewState isn't one of
them.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"lanem" wrote:
I want to use server.transfer to go to a new aspx page. I want to be able to
still have the viewstate from the previous page. I have researched this and
see a lot about it, but I can't find a good straight forward example. Does
anyone know how to do this? I'm using asp.net 2.0 and vb.net. Thanks.

Feb 22 '06 #4

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

Similar topics

1
4963
by: | last post by:
Is it possible to access the previous page's viewstate directly through the context object after a server.transfer. If so, how? The way i'm doing it is saving all needed items to a structure on the previous page, then accessing its variables. I would like a much more direct way if one exists. thanks
1
2425
by: Jim Mitchell | last post by:
If I do a server.transfer, do I loose the view state? What if the user hits the back button after a server.transfer? Do I get the viewstate back? Thanks in advance. Jim
1
1447
by: Stephen | last post by:
I've been working on some code which will hopefully allow me to transfer the contents of an arraylist on one page over to another page. The Arraylist is held in the viewstate object as it is populated on the on-click event of a button. Im trying to move to another page and carry over the items in my arraylist and write them to the page. The code ive been trying to work with to achieve is detailed below. I am getting an error and im not...
1
35147
by: Tim C. | last post by:
I get the error "error executing child request" when I use the Server.Transfer method to invoke a second aspx page. The following code is executed in a LinkButton click eventhandler on Page1.aspx. Server.Transfer("Page2.aspx",True) This code is virtually identical to the examples in chapter 4 (p. 196) of Microsoft's _Developing Web Applications_ 2nd edition, by Jeff Web. For what I'm
3
1881
by: yma | last post by:
Hi, I put a .aspx page inside Server.Transfer() within a button. The page was created for testing so it only has button and I did not add code. When I click the button, it gave me an error below. Could try this and help me? Thank a lot. --Chris Server Error in '/mysite/WebApplication1' Application. ---------------------------------------------------------------------------- ----
1
3496
by: Victor Song | last post by:
Hi We are trying to stream a file using server.transfer rather than response.redirect. We have it working for IIS 5.0 but IIS 6.0 refusing to let us transfer the file. If we do the less efficient prompt/response technique to the browser both work fine. We found this article that was only slightly appicable (ms-help://MS.MSDNQTR.2004APR.1033/enu_kbiis/iis/326965.ht kb 326965 ) but since csv is already a defined mime type this shouldn't...
2
4359
by: RAJ | last post by:
In our multi-tier application, we have several ASP.NET user controls which will update the same data source provided by middle tier logic. In this particular scenario we have one user control displaying the contents of the data source, whilst another control updates the datasource via a command buttons implementation of 'Click', an event raised in the 'Handle Postback Events' stage of the control execution life cycle (via the...
4
1861
by: Terry Olsen | last post by:
Since both methods seem to produce the same results, in which cases would you prefer one over the other? The only thing I would think is using Server.Transfer because of some browsers blocking redirects. *** Sent via Developersdex http://www.developersdex.com ***
1
1727
by: Mike Hofer | last post by:
I really need some help, and I'd appreciate any that you folks can provide. The ASP.NET application in question uses version 1.1 of the .NET Framework. All of the pages use a common base class (derived from System.Web.UI.Page). So, for instance, my home page's inheritance chain looks like this: HomePage Inherits WebPageBase
0
9645
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10153
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
10093
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
9952
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
6740
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
5381
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...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3654
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2880
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.