473,803 Members | 4,192 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Transfering viewstate from one page to another?

Hi all,

I have an application which enables a user to register and select a series
of resources to go with their profile.

At the moment I have an issue on the section where they will select the
resources, this is done by launching a popup window, displaying the list of
available resources and then the user can select one, in turn this should
then populate the parent window.

My problem is that when I retrieve the list of resources from the database I
only want to display to the user the ones that they have not already
selected, or those that come pre-selected in their role.

In the viewstate I have my own object "UserRegistrati on" which holds this
detail, so how can I communicate the viewstate from the parent page to the
popup window so that I might instantiate a new UserRegistratio n object on my
popup?

I would prefer to do something like this as opposed to always returning all
resources as there are quite a few, and in addition, even if I did return
ALL resources, I'd then have to iterate through them and still not display
the ones they have, so I'd still need a method of communicating between the
two windows.

Thanks in advance for any help,

Regards

Rob
Feb 23 '07 #1
2 1807
you should use session instead of viewstate and your users will enjoy
quicker pages.

-- bruce (sqlwork.com)

Rob Meade wrote:
Hi all,

I have an application which enables a user to register and select a series
of resources to go with their profile.

At the moment I have an issue on the section where they will select the
resources, this is done by launching a popup window, displaying the list of
available resources and then the user can select one, in turn this should
then populate the parent window.

My problem is that when I retrieve the list of resources from the database I
only want to display to the user the ones that they have not already
selected, or those that come pre-selected in their role.

In the viewstate I have my own object "UserRegistrati on" which holds this
detail, so how can I communicate the viewstate from the parent page to the
popup window so that I might instantiate a new UserRegistratio n object on my
popup?

I would prefer to do something like this as opposed to always returning all
resources as there are quite a few, and in addition, even if I did return
ALL resources, I'd then have to iterate through them and still not display
the ones they have, so I'd still need a method of communicating between the
two windows.

Thanks in advance for any help,

Regards

Rob

Feb 23 '07 #2
"bruce barker" wrote ...
you should use session instead of viewstate and your users will enjoy
quicker pages.
Hi Bruce,

Thanks for the reply.

Currently the pages are running like lightning, the object in the view state
is not a large one, also, I dont have to worry about them disappearing for
an hour on a coffee break and then coming back to me moaning because they
had to start the registration process again... :o)

Users *tut* World on a stick etc etc... :o)

Any thoughts on accessing the viewstate from the popup? ie, can it be done?
I read that its all hashed up too which made me wonder if even if I could
access it when I then tried to do something with it in the popup window
whether it would just fail?

My only ideas at the moment aside from accessing the view state are:

1. Use a session to hold the resource ID's currently added (dont want to do
this for the reason above)
2. As the button to add a resource is in my update panel and is created
dynamically, I could appended the resources ID's in an encrypted fashion to
the end of the link so that they are then available to the popup...for me
whilst this might work it felt a bit of a "dirty" solution, ie, if I have
all of the required data in one place, why replicate it again just to get
around this problem...

I could equally save the userRegistratio n objects data out on the load of
this page, and then pass a registration id across but the whole point of
using the viewState and my custom object in it was to avoid both session
time outs and hits back and forth to the database, compared to the original
version of this application it really is the dogs danglies so far (in my
opinion! :o) )

Rob
Feb 23 '07 #3

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

Similar topics

3
2654
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 and this causes control B to be created, when this is done the VIEWSTATE is lost for CONTROL B. In the EVENT that causes CONTROL B to be created I have to set
7
3067
by: JezB | last post by:
How can I get to a page's ViewState from inside a business object ? I have a reference to the calling page but the ViewState property of the Control class is protected. Is there something similar to HttpContext.Current.Session that allows a business object to access the current Session ?
3
2320
by: jzink | last post by:
How come I can use the following line in my page_load ViewState = "xxxx" But when I try the same line of code in another function I get the following compile error An object reference is required for the nonstatic field, method, or property 'System.Web.UI.Control.ViewState Do I need to reference ViewState some how thru the HttpContext.current ???
4
2165
by: nicholas | last post by:
I'm using context to transfer variables from 1 page to another. But, with more than 2 pages it fails. Ex: page1.aspx: Context.Items.Add("customername", customername.text) Server.Transfer("page2.aspx") page2.aspx: response.write(Context.Items("customername")) => returns the customername
3
4577
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...
11
2485
by: Nad | last post by:
Hello, I have a page with two link buttons. When I click on the first one I call server.execute("target.aspx") to view target.aspx on the original page. Then I click on the second link button and in this case I redirect to another page, HOWEVER, I get Invalid ViewState exception. I know the problem stems from server.execute but don't know why. Any Ideas? Thank you.
10
3097
by: Robert | last post by:
I have an app that was originally 1.1, now migrated to 2.0 and have run into some sporadic viewstate errors...usually saying the viewstate is invalid, eventvalidation failed or mac error. My web config does specify a machinekey setting: <machineKey validationKey="447C05E8B3A71401CC4CAE5513A7F1A3494A3618EE819316AAD1D58433F236A759D66FB4154500E01EB4E1BC1DE42046E2D652D391CB8367A1649438867A02EB"...
10
1647
by: Lloyd Dupont | last post by:
When you define UserControl in source code the sample I see are often like that: ============ public string Text { get { String s = (String)ViewState; return ((s == null) ? String.Empty : s); }
3
626
by: George Thompson | last post by:
Hi, I come from an ASP background, and I am currently working on a .NET project, so please excuse me if this is a dumb question ... I have written a dynamically generated menu that uses the following structure (looping through for each menu item needing to be displayed): <tr>
0
9564
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
10548
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
10316
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
10295
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
10069
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
6842
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
5629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.