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

ASP viewstate persistence

Dst
What would be the correct way to do this:

Page A:
ComboBox with values A/B/C
Button which redirects to page B.

Page B.
Button which redirects to Page A.

Start page A, combo box has the value A.
Now if i change the combo box in page A to the value B.
Click on the button which takes my to Page B.
Click on the button which takes me back to page A.

Then the viewstate for the combo has been reset to the value A.

So what are the correct way to handle this persistance ?

And what if i need to return values from page B to page A ?
Like a flag which indicates if page B has been cancelled.
In page A check if page B was cancelled and do different stuff.
How is this done ?

I know i can send parameters to page B like this asp?id=10 etc.
Do i need to do it the same way when sending back to page A ?
What i'm actually are going to do is have a datagrid + 4 comboboxes in
page A.
And a add new record function which will redirect to page B for input
of 6 values.
Then goback to page B and refresh the dataset if page B was not
cancelled.
If cancelled then display the same state for the comboboxes and the
datagrid
as before redirecting to page B.

I'm new to this so need some pointers :).

May 18 '06 #1
2 1340
I think the querystring aproach would be the simplest way to go about.
Another aproach would be to use cross-page postbacks, but that would be
a bit messy (you would have to keep the values for the comboboxes
somewhere in page B, and then re-read them from A). Also, the Session
object is an alternative, but I've been taught to stay away from it :P

May 18 '06 #2
Do you absolutively need to have two separate pages?

Why not use either :

Option 1 :
Expand|Select|Wrap|Line Numbers
  1. <asp:Panel runat=server id=pStepOne visible=true>
  2. ... <asp:button runat=server id= btShowStepTwo
  3. onClick='btShowStepTwo_Click'/>
  4. </asp:Panel>
  5.  
  6. <asp:Panel runat=server id=pStepTwo visible=false>
  7. ... <asp:button runat=server id= btShowStepOne
  8. onClick='btShowStepOne_Click'/>
  9. </asp:Panel>
  10.  
Option 2 : Use the ASP:MultiViews
<asp:MultiView runat="server" ActiveViewIndex="0">
<asp:View>view one </asp:View>
<asp:View>view two</asp:View>
</asp:MultiView>
<asp:button runat=server onclick="btSwitch_Onclick" text="Switch
views"/>

Option 3: create two usercontrols, so you can reuse them on several
pages

Hope that helps!

May 18 '06 #3

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

Similar topics

3
by: Trevor Andrew | last post by:
Hi There, I have a small ASP.NET application under development. I am using VS.NET 2002 (2003 upgrade is on the way) with .NET Framework 1.1. It is hosted on a web hosting service in the US. I am...
1
by: Ralph Soons | last post by:
Hi all, I am trying to save the viewstate in a session instead of storing it in a hidden of the webpage which is default. This because of performance reasons. When I use line 2 in combination...
1
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? ...
3
by: jenn | last post by:
Hi I was using Sessionto persist datatables, but now I don't think it's good idea to do so as Session can cause overhead on the server (as the number of users grow), so I use ViewState to store...
10
by: Simon Harvey | last post by:
Hi everyone, Can anyone tell me if I declare a global variable in my pages code behind, is it persisted if the page does a post back, or do I need to add the object to the session object in...
4
by: Marcel Balcarek | last post by:
Hello, I have a page (page1.aspx) that builds some complex .NET objects. I successfully pass these objects to another different window (page2.aspx). How can I persist these objects on a POST...
1
by: Jerry Spencer | last post by:
I have a form with two dynamically created controls. One control is a list box, the other is a text box. I would like to set the value of the text box based on the selection of the list box. I...
1
by: RHIZOME | last post by:
I am reparameterizing a SqlDataSource programmatically, using runtime events. This works nicely for on-the-fly search, but sorting and paging are using the original (declared) version of my...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.