Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to return to previous section without losing data

How to return to previous section without losing data

Scheduled Pinned Locked Moved ASP.NET
csharphtmlasp-netjsonhelp
1 Posts 1 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    samflex
    wrote on last edited by
    #1

    I have a unique situation where all asp.net markup code are all one page divided by sections. In one particular section called

    sect_MPE

    , all markups are stored in this section. Users would enter data into textbox and DropDownList controls nd click the Preview button. If user has a has a need to go back to the previous section to make changes, the user is allowed to do so by click the Go Back button. Below is the method I have created for going back to the previous section.

        Private Sub returnwithvalues()
            
            sect\_MPE.Show()
            
            'Create and assign session variables
            
            'Save txtDateReceived into a session variable for later use. Do this for rest of form fields
            Session("dtReceived") = txtDateReceived.Text
    
            If Session("dtReceived") IsNot Nothing Then
                Dim dteReceived As String = Session("dtReceived").ToString()
                txtDateReceived.Text = dteReceived
            End If
            
            Session("Iaddress") = instAddress.Text
            If Session("Iaddress") IsNot Nothing Then
                Dim ia As String = Session("Iaddress").ToString()
                instAddress.Text = ia
            End If
            
        End Sub
        
        
        Protected Sub goBack\_Click(ByVal sender As Object, ByVal e As EventArgs) Handles goBack.Click
      returnwithvalues()
        End Sub
    

    When a user clicks the Go Back button, s/he is taken to the correct section, Sect_MPE section but values on the form are lost. Could please help with what's wrong with the code I posted above. In the sample code I posted above for instance, initially, the value of the form fields are stored in session. Then when user clicks to go go back, the values in session is stored back into the form field so the data persists. I might be approaching it incorrectly. Thanks in advance for your assistance.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups