Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you don't have a form of secondary storage for this data, using either <code>Session</code> storage or <code>Server.Transfer</code> would work.</p> <p>You might find <code>Server.Transfer</code> is a little neater as, this way, you'll retain your POST values across the transfer. This will potentially save you a lot of cumbersome code playing around with session state, which, depending on how complex your forms are, could open the way to all kinds of unusual behaviour that you'd have to predict and plan to deal with in advance such as what happens when a user clicks the "back" button or - if you're posting across multiple pages - what happens when a session expires (plus Servy's examples of having multiple tabs open on the same page(s), all sharing the same session). Working with session state can be messy.</p> <p>Perform your validation on PostBack then, if <code>Page.IsValid</code>, do:</p> <pre><code>Server.Transfer("/FormPage2.aspx"); </code></pre> <p><code>Server.Transfer</code> preserves <code>Request.QueryString</code> and <code>Request.Form</code>, so you can pick up your POST values on <code>FormPage2</code> and do whatever you need with them here - whether it be using them for conditional logic or rendering them out again as hidden fields to join them up with the values from the second page of the form (bear in mind that if you're doing this you'll have to revalidate the hidden inputs at this stage).</p> <p><a href="http://msdn.microsoft.com/en-us/library/y4k58xk7.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/y4k58xk7.aspx</a></p> <p>I have used session state for handling complex forms in the past and found myself wishing I'd used <code>Server.Transfer</code>, which I plan to use for all similar endeavours in the future, unless I have a very good reason not to.</p> <p>You might also consider using a <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.multiview.aspx" rel="nofollow">multiview</a>, but in my experience these can be very messy.</p> <p>Hope this helps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload