How to keep a session state

Posted on 2011-10-10
Last Modified: 2012-08-14
I have a web page that allows user to pick a community and it list in a grid all the workorders associated with that community.  Then they can click a edit command and it takes them to another web page which shows them details of the work order and allows them to edit it.  My question is when they are done editing and I want to take them back to the first web page, how can I keep the list that is already in the grid and the community they selected without having them pick the community again.  
Question by:mgmhicks
    LVL 7

    Accepted Solution

    You can store session variables in the current session object (Asp pages usually supply a "Session" property that you can save items in a Key/Value type of arrangement.

    ' Access the session object statically '
    ' Store values '
    Private MyWorkOrdersList As New List(Of WorkOrder)
    Session("WorkOrdersList") = MyWorkOrdersList
    ' Retrieve Values from other pages (or the same) '
    Private MyWorkOrdersList As List(Of WorkOrder)
    MyWorkOrdersList = Trycast(Session("WorkOrdersList"), List(Of WorkOrder))
    If MyWorkOrdersList IsNot Nothing Then
        ' Use the saved work orders '
    End If

    Open in new window

    LVL 83

    Expert Comment

    As you are changing pages, you can use querystring as well. For example, you can use a

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    It’s quite interesting for me as I worked with Excel using for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
    A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now