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 8147913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:30:54+00:00 2026-06-06T14:30:54+00:00

I need a field to store some information after one asp button click for

  • 0

I need a field to store some information after one asp button click for another asp button’s click.

I saw that it wasn’t working so I wrote the following simple page codebehind (thinking that perhaps some of my code was causing it) but here I can see that the field really does get re-initialized.

I suppose that every button click reloads the page. Is this true? And if so – how can this be overcome without a static variable (-because what if more than one person is accessing the same page at once…)?

public partial class _Default : System.Web.UI.Page
{
    string s = "a";

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        s = "b";
    }

    protected void Button2_Click(object sender, EventArgs e)
    {
        here.InnerText = s;// "here" is an id.
        //returns "a" despite Button1 having been clicked before.
    }
}
  • 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-06T14:30:56+00:00Added an answer on June 6, 2026 at 2:30 pm

    add in your code (EnableViewState)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to store some Photo related information for my app. I understand that
I have some user-specific data that I need to store in SharePoint and make
I need to be able to store some information about the user and I
I'm working on an ASP.NET4.0/C# application for a public site that needs to authenticate
I'm writing an application that has 5 threads that get some information from web
I am coding a psychology experiment in Python. I need to store user information
I'm working on updating a system that stores financial information and am using a
I am writing a .net application that is taking form information to do some
Essentially I need to retrieve some account information from the dbase table where they
I have a use case where I only need to store certain fields to

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.