Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7855719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:28:10+00:00 2026-06-02T20:28:10+00:00

My situation goes like this: I have these lists with data inserted into them

  • 0

My situation goes like this: I have these lists with data inserted into them when a user presses an ADD button, but I guess on postback the Lists are re-zeroed. How do you keep them preserved? I’ve been looking for the answer, but I guess I don’t quite understand how to use the session, etc.

I’m very new to ASP.net and not much better with C# it would seem.

public partial class Main : System.Web.UI.Page
{


 List<string> code = new List<string>();


protected void Page_Load(object sender, EventArgs e)
{
    //bleh   

}

protected void cmdAdd_Click(object sender, EventArgs e)
{

    code.Add(lstCode.Text);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T20:28:11+00:00Added an answer on June 2, 2026 at 8:28 pm

    Just use this property to store information:

    public List<string> Code
    {
        get
        {
            if(HttpContext.Current.Session["Code"] == null)
            {
                HttpContext.Current.Session["Code"] = new List<string>();
            }
            return HttpContext.Current.Session["Code"] as List<string>;
        }
        set
        {
            HttpContext.Current.Session["Code"] = value;
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok here goes my situation: I have a core-data generated class Quantity which has
I have a double namespace situation, where my controllers look like this: CandidateController Candidate::PerformanceController
This question goes beoynd just programming, but I'd like to get some input on
My situation is this: We have a superclass, MyAbstractEntity @Entity @Table(name = MyTable) @Inheritance(strategy
I have such a situation: when I'm running my project with breakpoints, compiler goes
Have you ever encountered a situaton like this, and if so, how did you
Here is the situation. This small company I'm working with wants to have a
there is my situation. I have same activities which goes one by another, no
So I'm making this android application, that needs to read data from user-provided CSV
Situation : I have a keydown handler with a switch for what key is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.